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

            return(matches.Select(m => m.Instantiate()).ToArray());
        }
        public static bool IsDefined(MemberInfo element, Type attributeType, bool inherit)
        {
            IEnumerable <CustomAttributeData> matches = element.GetMatchingCustomAttributes(attributeType, inherit);

            return(matches.Any());
        }