如何遍历一个枚举?
来源:互联网 发布:省市县数据库 编辑:程序博客网 时间:2024/04/30 20:03
using System;
public class EnumTest {
enum Days { Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday };
public static void Main() {
Type weekdays = typeof(Days);
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"));
}
}
public class EnumTest {
enum Days { Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday };
public static void Main() {
Type weekdays = typeof(Days);
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"));
}
}
- 如何遍历一个枚举?
- 如何遍历显示一个枚举的内容
- 如何遍历一个BLOCK
- 如何遍历一个HashMap
- 如何遍历一个BLOCK
- 如何遍历一个HashMap
- 如何遍历一个List
- 枚举遍历
- 如何倒序遍历一个ArrayList
- 如何遍历枚举类型的对象、并获取枚举类型长度
- 【文件遍历】如何遍历一个文件夹中的文件呢
- 如何遍历一个程序中的所有控件
- 如何遍历一个窗体上的控件
- 如何遍历删除一个数组中的对象
- java种如何遍历一个List集合
- C#遍历Struct,遍历枚举
- C#遍历枚举
- C#遍历枚举
- 2005.4.13 星期三 晴/风
- 哄MM用的经典爱情短信
- 同学电脑中毒了
- 软考网工
- google站内搜索
- 如何遍历一个枚举?
- 卖火柴的小女孩
- 2005.4.14 星期四 晴
- 房博会
- DataGrid资料
- C51单片机P0口和中断输入口要注意的问题
- 十二星座男人被老婆打的时候
- 毕业后就要去深圳了!
- 一种循环注入的思路