Monday, December 10, 2012

How to iterate an Enum in C#?

            Array values = Enum.GetValues(typeof(MyEnumType));
            foreach (MyEnumType val in values)
            {
                var enumName = Enum.GetName(typeof(MyEnumType), val);
            }

No comments:

Post a Comment