转自:https://blog.csdn.net/moxiaomomo/article/details/8267042
假设有enum类型定义为MyEnumType
则可以这样遍历:
foreach (MyEnumType type in Enum.GetValues(typeof(MyEnumType)))
{
// TODO: 遍历操作
}
或者:
foreach (string name in Enum.GetNames(typeof(MyEnumType)))
{
// TODO:遍历操作
}