public static bool IsDefined(this ParameterInfo element, Type attributeType) { IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(attributeType, inherit: true); return(matches.Any()); }
public static IEnumerable <T> GetCustomAttributes <T>(this ParameterInfo element, bool inherit) where T : Attribute { IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(typeof(T), inherit, skipTypeValidation: true); return(matches.Select(m => (T)(m.Instantiate()))); }
public static IEnumerable <Attribute> GetCustomAttributes(this ParameterInfo element, Type attributeType, bool inherit) { IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(attributeType, inherit); return(matches.Instantiate(attributeType)); }
public static IEnumerable <Attribute> GetCustomAttributes(this ParameterInfo element, bool inherit) { IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(null, inherit, skipTypeValidation: true); return(matches.Select(m => m.Instantiate())); }
public static T GetCustomAttribute <T>(this ParameterInfo element, bool inherit) where T : Attribute { IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(typeof(T), inherit, skipTypeValidation: true); return(matches.OneOrNull <T>()); }
public static Attribute GetCustomAttribute(this ParameterInfo element, Type attributeType, bool inherit) { IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(attributeType, inherit); return(matches.OneOrNull <Attribute>()); }