/// <summary> /// Determines whether the <paramref name="provider"/> element has an associated <see href="Attribute"/> /// of type <paramref name="attributeType"/>. /// </summary> /// <returns>True if the source element has the associated attribute, false otherwise.</returns> public static bool HasAttribute(this ICustomAttributeProvider provider, Type attributeType) { return(provider.Attribute(attributeType) != null); }
public static bool HasAttribute <T>(this ICustomAttributeProvider provider, out T attribute, bool inherit = true) where T : Attribute { attribute = provider.Attribute <T>(inherit); return(attribute != null); }