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