Esempio n. 1
0
        public static Attribute GetCustomAttribute(this Module element, Type attributeType)
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(attributeType);

            return(matches.OneOrNull <Attribute>());
        }
Esempio n. 2
0
        public static bool IsDefined(this Module element, Type attributeType)
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(attributeType);

            return(matches.Any());
        }
Esempio n. 3
0
        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())));
        }
Esempio n. 4
0
        public static IEnumerable <Attribute> GetCustomAttributes(this Module element, Type attributeType)
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(attributeType);

            return(matches.Instantiate(attributeType));
        }
Esempio n. 5
0
        public static IEnumerable <Attribute> GetCustomAttributes(this Module element)
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(null, skipTypeValidation: true);

            return(matches.Select(m => m.Instantiate()));
        }
Esempio n. 6
0
        public static T GetCustomAttribute <T>(this Module element) where T : Attribute
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(typeof(T), skipTypeValidation: true);

            return(matches.OneOrNull <T>());
        }