Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iterating and Enumeration

Status
Not open for further replies.

KoRUPT

Programmer
Jul 25, 2002
25
0
0
CA
How would I go about Iterating through all the elements of an enumeration in C#? Something like so:

public enum Test{One, Two, Three, Four, Five};

foreach(Test t in Test)
{
MessageBox.Show(t.ToString());
}


This doesnt work unfortunatly :(
 
I think you can do it via reflection, but it won't be what you'd call fast. Or pretty.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top