C#遍历枚举

http://zhidao.baidu.com/question/91664114.html 

class GetEnumValues 
{ 
public static void Main() 
{ 
Type Sexs = typeof(SexKind); 
Console.WriteLine("The kinds of the Sex:"); 
foreach (string s in Enum.GetNames(Sexs)) 
{ 
Console.WriteLine(s); 
} 
} 
} 

enum SexKind 
{ 
Male, 
Female 
}
posted @ 2012-05-14 15:11  Billy.rao  阅读(192)  评论(0编辑  收藏  举报