There are a lot of examples in which you can Get Enum by Custom attribute like here Get Enum from Description attribute
public static class EnumEx
{
    public static T GetValueFromDescription<T>(string description)
    {
        var type = typeof(T);
        if(!type.IsEnum) throw new InvalidOperationException();
        foreach(var field in type.GetFields())
        {
            var attribute = Attribute.GetCustomAttribute(field,
                typeof(DescriptionAttribute)) as DescriptionAttribute;
            if(attribute != null)
            {
                if(attribute.Description == description)
                    return (T)field.GetValue(null);
            }
            else
            {
                if(field.Name == description)
                    return (T)field.GetValue(null);
            }
        }
        throw new ArgumentException("Not found.", "description");
        // or return default(T);
    }
}
But here the problem is that you have to hardcode the attributeType i.e. typeof(DescriptionAttribute)) as DescriptionAttribute
How do i convert this example into Generic extension so that i dont have to hardcoded the CustomAttributeType.
 
     
     
     
    