C#: 枚举
摘要:
枚举是用户定义的整数类型。在声明一个枚举时,要指定该枚举可以包含的一组可接受的实例值。using System;namespace ConsoleApplication3{classProgram{staticvoid Main(string[] args){WriteGreeting(TimeOfDay.afternoon);// 从字符串中获取枚举值,并转换为整数TimeOfDay time2 = (TimeOfDay)Enum.Parse(typeof(TimeOfDay), "afternoon", true);Console.WriteLine((int)time 阅读全文
posted @ 2013-02-23 17:17 LilianChen 阅读(522) 评论(0) 推荐(1) 编辑