"Yosh" <Yo**@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
What is the best method to convert an integer to Enum equivelant?
I hope this makes sense.
Thanks,
David
// Notice the type specifier, int.
public enum MyEnums : int
{
Enum1 = 0,
Enum2,
Enum3
}
...
MyEnum myVar = 1;
...
Another way:
MyEnum myVar = (MyEnums) 1;
...
If you just have the name of the enum value:
MyEnum myVar = System.Enum.Parse(typeof(MyEnums), "Enum2");
Hope this helps ;)
Mythran