Archive

Archive for October, 2015

basic enum parsing in c#

October 9, 2015 Leave a comment

Below script helps to parse a enum value and handle unexpected values

CustomEnumXXX enum_var;
if (Enum.TryParse(stringvalueEnumYYYYY, out enum_var))
{
enum_var has the parsed correct value
}
else
{
eerror while parsing
}

Advertisements
Categories: Prsnl References