C#遍历枚举
来源:互联网 发布:nginx配置技巧 编辑:程序博客网 时间:2024/05/21 07:09
using System;
public class EnumTest {
enum Days { Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday };
enum BoilingPoints { Celcius = 100, Fahrenheit = 212 };
[FlagsAttribute]
enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 };
public static void Main() {
Type weekdays = typeof(Days);
Type boiling = typeof(BoilingPoints);
Console.WriteLine("The days of the week, and their corresponding values in the Days Enum are:");
foreach ( string s in Enum.GetNames(weekdays) )
Console.WriteLine( "{0,-11}= {1}", s, Enum.Format( weekdays, Enum.Parse(weekdays, s), "d"));
Console.WriteLine();
Console.WriteLine("Enums can also be created which have values that represent some meaningful amount.");
Console.WriteLine("The BoilingPoints Enum defines the following items, and corresponding values:");
foreach ( string s in Enum.GetNames(boiling) )
Console.WriteLine( "{0,-11}= {1}", s, Enum.Format(boiling, Enum.Parse(boiling, s), "d"));
Colors myColors = Colors.Red | Colors.Blue | Colors.Yellow;
Console.WriteLine();
Console.WriteLine("myColors holds a combination of colors. Namely: {0}", myColors);
}
}
- C#遍历Struct,遍历枚举
- C#遍历枚举
- C#遍历枚举
- c#遍历枚举
- C# 遍历枚举
- C# 遍历枚举
- C#遍历枚举类型
- C#遍历枚举类型
- C# 遍历枚举类型
- C#枚举遍历--Enum
- C#遍历枚举
- c#枚举遍历(转换)
- C#中遍历枚举示例代码
- C#遍历枚举类型的所有元素
- C#遍历枚举(Enum)值
- 枚举遍历
- c# 遍历枚举(转自博客园)
- C# 获取枚举的 键名称,值 和描述 遍历枚举
- Sybase从Windows到Linux的迁移指南(使用资源文件来快速新建sybase服务器)
- 第7章 什么是敏捷设计
- 通过CCNA成功者的经验
- Weblogic几个403错误的分析
- 使用memcache实现session共享
- C#遍历枚举
- JDBC编程的步骤
- 文件监控
- C语言的位域和符号位扩展
- 详谈新站关键词排名不稳定之解析
- delphi中关于资源释放(Free/release/freeAndNil)的一点体会
- 关于不能直接在flex Application 里addChild的解决方法
- String Stringbuffer和StringBuilder的区别
- SVN+Trac开发环境搭建