namespace FuseDigital.QuickSetup.Extensions;

public static class EnumExtensions
{
    public static T GetAttribute<T>(this Enum enumVal) where T : System.Attribute
    {
        var type = enumVal.GetType();
        var memInfo = type.GetMember(enumVal.ToString());
        var attributes = memInfo[0].GetCustomAttributes(typeof(T), false);
        return (attributes.Length > 0) ? (T) attributes[0] : null;
    }
}