eXtreme Programming
XP for the programmer
28 January 2010
How to enumerate enum values?
To enumerate an enum use the GetValues of the Enum class.
For example:
foreach (int carColorValue in Enum.GetValues(typeof(CarColorEnum))
{
string carColorName = Enum.GetName(typeof(CarColorEnum), carColorValue);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment