public static T GetCustomAttribute <T>(this MemberInfo element) where T : Attribute
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(typeof(T), inherit: true, skipTypeValidation: true);

            return(matches.OneOrNull <T>());
        }
        public static Attribute GetCustomAttribute(this MemberInfo element, Type attributeType, bool inherit)
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(attributeType, inherit);

            return(matches.OneOrNull <Attribute>());
        }
        public static bool IsDefined(this MemberInfo element, Type attributeType, bool inherit)
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(attributeType, inherit);

            return(matches.Any());
        }
        public static IEnumerable <T> GetCustomAttributes <T>(this MemberInfo 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 MemberInfo element, Type attributeType, bool inherit)
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(attributeType, inherit);

            return(matches.Instantiate(attributeType));
        }
        public static IEnumerable <Attribute> GetCustomAttributes(this MemberInfo element, bool inherit)
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(null, inherit, skipTypeValidation: true);

            return(matches.Select(m => m.Instantiate()));
        }