Is there a way to iterate through all enum values?

vIceBerg picture vIceBerg · Sep 30, 2008 · Viewed 16.7k times · Source

Possible Duplicate:
C#: How to enumerate an enum?

The subject says all. I want to use that to add the values of an enum in a combobox.

Thanks

vIceBerg

Answer

albertein picture albertein · Sep 30, 2008
string[] names = Enum.GetNames (typeof(MyEnum));

Then just populate the dropdown withe the array