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

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

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

            return(matches.Instantiate(attributeType));
        }
Ejemplo 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()));
        }
Ejemplo 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>());
        }