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);
}
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)