You can use the Enum.GetValues method to iterate through all values of an enumerated type. You can use this method to dump out the name and value of each enumeration value in the enumerated type.
1 2 3 4 5 6 7 8 9 | public enum Moods{ NOMOOD = 0, Ambivalent = 1, Crabby = 10, Grouchy = Crabby - 1, Happy = 42, SuperHappy = 2 * Happy} |
1 2 | foreach (Moods mood in Enum.GetValues(typeof(Moods))) Console.WriteLine("{0} - {1}", mood, (int)mood); |

