如何获得枚举中的值
分类:.Net知识问答| 发布:camnprbubuol| 查看: | 发表时间:2011/9/15
C-sharp代码
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
-
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
-
- Console.WriteLine(TaskStatus.Complete);
-
-
- Console.WriteLine((int)TaskStatus.Complete);
- Console.WriteLine(Convert.ToInt32(TaskStatus.Complete));
-
-
-
-
- }
- public enum TaskStatus : int
- {
- Begin = 0,
- Complete = 100,
- }
- }
- }
运行结果:
Complete
100
100
请按任意键继续. . .
来源:http://daimajishu.iteye.com/blog/1079065