How can I get the enum value if I have the enum string or enum int value. eg: If i have an enum as follows:
public enum TestEnum { Value1 = 1, Value
No, you don't want a generic method. This is much easier:
MyEnum myEnum = (MyEnum)myInt; MyEnum myEnum = (MyEnum)Enum.Parse(typeof(MyEnum), myString);
I think it will also be faster.