public static T GetAttribute <T>(this Type type) where T : class { Attribute customAttribute = type.GetCustomAttribute(typeof(T)); if (!customAttribute.IsStringEmpty()) { return(customAttribute as T); } return(default(T)); }