.Net Goodness – Enumerating through an enumeration

The other day a friend of mine was asking if there was a simple way through reflection to list all the items in an enumeration. I figured I would share that answer here in case you need it too.  Have a great day!

public enum DayOfWeek

static void Main(string[] args)
   Type dayOfWeekType = typeof(DayOfWeek);
   foreach (DayOfWeek day in Enum.GetValues(dayOfWeekType))

Comments (0)

Skip to main content