C#中对于枚举(Enum)类型的遍历方法
假设有enum类型定义为MyEnumType
则可以这样遍历:
foreach (MyEnumType type in Enum.GetValues(typeof(MyEnumType)))
{
// TODO: 遍历操作
}
或者
foreach (string name in Enum.GetNames(typeof(MyEnumType)))
{
// TODO:遍历操作
}
