I'm going to grab the enum value from a querystring.
For instance lets say I have this enum:
Enum MyEnum
{
Test1,
Test2,
Test3
}
I'm going to grab the value from an incoming querystring, so:
string myEnumStringValue = Request["somevar"];
myEnumStringValue could be "0", "1", "2"
I need to get back the actual Enum Constant based on that string value.
I could go and create a method that takes in the string and then perform a case statement
case "0":
return MyEnum.Test1;
break;
but there's got to be an easier or more slick way to do this?