Generic Moral Parameterising datatypes or other to reduce the code length Share this:Click to share on Twitter (Opens in new window)Click to share on Facebook (Opens in new window)Click to share on LinkedIn (Opens in new window)Like Loading...
January 20, 2014 at 8:21 am
Enum to string
private static T ToEnum(string value)
{
return (T)Enum.Parse(typeof(T), value, true);
}
private string EnumToString(T enumValue)
{
Type typeParameterType = typeof(T);
return Enum.GetName(typeParameterType, enumValue);
}