How to retrieve the integer value of an enum?
Posted
by Natrium
on Stack Overflow
See other posts from Stack Overflow
or by Natrium
Published on 2010-04-13T07:34:39Z
Indexed on
2010/04/13
7:43 UTC
Read the original article
Hit count: 187
c#
I have an enum
public enum Color
{
Red = 0,
Blue = 1,
Yellow = 2
}
When I do this:
Color color = Color.Blue;
Console.Writeline(color.Value);
I want to see it's integer-value (1 in this case, but it outputs "Blue" instead.
How can I solve this?
I use .NET 3.5.
© Stack Overflow or respective owner