枚举

public  enum testenum

{

      aa,

      bb,

      cc,

     dd

};
//遍历枚举
foreach (testenum item in Enum.GetValues(typeof(testenum)))
{

}
Enum.GetValues(typeof(枚举的名称));可以获得指定枚举的枚举值。
Enum.GetNames(typeof(枚举的名称));可以获得指定枚举的枚举名称。

原文地址:https://www.cnblogs.com/lhlong/p/5013260.html