【转载】#457 Converting Between enums and their Underlying Type
When you declare an enum, by default each enumerated value is represented internally with an int. (System.Int32 - 4 bytes). You can convert between values of the underlying type and enum values using an explicit cast. Because an enum is represented by an int by default, you can convert between integers and enum values.
Mood m = (Mood);
Console.WriteLine(m); // Petulant m = Mood.Crabby;
int i = (int)m;
Console.WriteLine(i); //
原文地址:#457 Converting Between enums and their Underlying Type
【转载】#457 Converting Between enums and their Underlying Type的更多相关文章
- 【转载】#458 Errors While Converting Between enum and Underlying Type
You can convert to an enum value from its underlying type by casting the underlying type (e.g. int) ...
- (转载)Android xml资源文件中@、@android:type、@*、?、@+引用写法含义以及区别
原帖地址:http://blog.csdn.net/zfrong/article/details/7332545 Android xml资源文件中@.@android:type.@*.?.@+引用写法 ...
- 关于C#你应该知道的2000件事
原文 关于C#你应该知道的2000件事 下面列出了迄今为止你应该了解的关于C#博客的2000件事的所有帖子. 帖子总数= 1,219 大会 #11 -检查IL使用程序Ildasm.exe d #179 ...
- [Chromium文档转载,第002章]Mojo C++ Bindings API
Mojo C++ Bindings API This document is a subset of the Mojo documentation. Contents Overview Getting ...
- Part 45 to 47 Talking about Enums in C#
Part 45 C# Tutorial Why Enums Enums are strongly typed constants. If a program uses set of integ ...
- Effective Java 34 Emulate extensible enums with interfaces
Advantage Disadvantage Enum types Clarity Safety Ease of maintenance. None extensibility Typesafe en ...
- FB01与F-02的区别(转载)
FB01与F-02的区别(转载) FB01 : a) ''Post Document'' b) No doc type as SA automatically comes. c) No automat ...
- C#可空类型(转载)
在程序开发中,有时候需要值类型也为可空类型,比如,在数据库中,我们可以把一个日期Datetime设置为null. 在C# 2.0中就出现了可空类型,允许值类型也可以为空(null),可空类型的实现基于 ...
- 【转载】Python: Enum枚举的实现
转自:http://www.cnblogs.com/codingmylife/archive/2013/05/31/3110656.html 从C系语言过来用Python,好不容易适应了写代码不打 ...
随机推荐
- 基于WebImage的图片上传工具类
支持缩略图和水印. using System; using System.IO; using System.Linq; using System.Web; using System.Web.Helpe ...
- Google Authenticator(谷歌身份验证器)
<!DOCTYPE html>Google Authenticator(谷歌身份验证器) ] Google Authenticator(谷歌身份验证器) Google Authentica ...
- Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.xService }: app is in background uid UidRecord(一)
Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.x ...
- shell 进阶变量的指定 declare
declare 设置 -r 只读 -i 设置整形 -a 数组 让指定的函数成为一个数组 -f 函数 如果在脚本中使用declare -f, 而不加任何参数的话, 那么将会列出这个脚本之前定义的所有函数 ...
- Tortoise SVN安装后右键没有菜单的解决方法
最近换了WIN7的操作系统,感觉用起来爽极了,于是开始一个个装软件,最让我头疼的就是安装SVN,安装没有问题,完成后却无法显示右键菜单,开始同事也帮我找原因,以为是我设置问题或者哪里阻止了程序,还以为 ...
- jquery 属性选择器
jquery 属性选择器 第一种根据属性选择E[attr] $("[title]").click().......... 即选择所有元素内 属性带有title的元素即<l ...
- C#(Winform)的SaveFileDialog(文件保存对话框)控件使用
#region 保存对话框 private void ShowSaveFileDialog() { //string localFilePath, fileNameExt ...
- 如何用webgl(three.js)搭建一个3D库房,3D密集架,3D档案室,-第二课
闲话少叙,我们接着第一课继续讲(http://www.cnblogs.com/yeyunfei/p/7899613.html),很久没有做技术分享了.很多人问第二课有没有,我也是抽空写一下第二课. 第 ...
- Node.js之Buffer
JavaScript 语言自身只有字符串数据类型,没有二进制数据类型.但在处理像TCP流或文件流时,必须使用到二进制数据.因此在 Node.js中,定义了一个 Buffer 类,该类用来创建一个专门存 ...
- mysql四-2:多表查询
一.介绍 本节主题: 多表连接查询 复合条件连接查询 子查询 准备表: #建表 create table department( id int, name ) ); create table empl ...