C# 遍历枚举(枚举是目的,遍历(获取)是手段)
2021-05-15 12:49
标签:string logs type ring get img body tool title C#中,如何获取(遍历)枚举中所有的值: C# 遍历枚举(枚举是目的,遍历(获取)是手段) 标签:string logs type ring get img body tool title 原文地址:https://www.cnblogs.com/chengqi521/p/8243016.html public enum Suits
{
Spades,
Hearts,
Clubs,
Diamonds,
NumSuits
}
private static void Main(string[] args)
{
foreach (Suits suit in Enum.GetValues(typeof(Suits)))
{
Console.WriteLine((int)suit+ ":" + suit);
}
}
文章标题:C# 遍历枚举(枚举是目的,遍历(获取)是手段)
文章链接:http://soscw.com/index.php/essay/85760.html