Demo:
public static T ToEnum<T>(this string name)
{
return (T)Enum.Parse(typeof(T), name);
}
public enum MyTestEnum
{
One=1,
Two=2,
Three=3
}
static void Main()
{
string enumMemberName="One";
ToEnum<MyTestEnum>(enumMemberName);
}