static private IsDefined ( ICustomAttributeProvider obj, |
||
obj | ICustomAttributeProvider | |
attributeType | ||
inherit | bool | |
return | bool |
internal static bool IsDefined(ICustomAttributeProvider obj, Type attributeType, bool inherit) { if (attributeType == null) { throw new ArgumentNullException("attributeType"); } if (MonoCustomAttrs.IsUserCattrProvider(obj)) { return(obj.IsDefined(attributeType, inherit)); } if (MonoCustomAttrs.IsDefinedInternal(obj, attributeType)) { return(true); } object[] pseudoCustomAttributes = MonoCustomAttrs.GetPseudoCustomAttributes(obj, attributeType); if (pseudoCustomAttributes != null) { for (int i = 0; i < pseudoCustomAttributes.Length; i++) { if (attributeType.IsAssignableFrom(pseudoCustomAttributes[i].GetType())) { return(true); } } } ICustomAttributeProvider @base; return(inherit && (@base = MonoCustomAttrs.GetBase(obj)) != null && MonoCustomAttrs.IsDefined(@base, attributeType, inherit)); }
public static bool IsDefined(MemberInfo element, Type attributeType, bool inherit) { CheckParameters(element, attributeType); MemberTypes mtype = element.MemberType; if (mtype != MemberTypes.Constructor && mtype != MemberTypes.Event && mtype != MemberTypes.Field && mtype != MemberTypes.Method && mtype != MemberTypes.Property && mtype != MemberTypes.TypeInfo && mtype != MemberTypes.NestedType) { throw new NotSupportedException(Locale.GetText( "Element is not a constructor, method, property, event, type or field.")); } #if NET_2_0 // MS ignores the inherit param in PropertyInfo's ICustomAttributeProvider // implementation, but not in the Attributes, so directly get the attributes // from MonoCustomAttrs instead of going throught the PropertyInfo's // ICustomAttributeProvider if (mtype == MemberTypes.Property) { return(MonoCustomAttrs.IsDefined(element, attributeType, inherit)); } #endif return(((MemberInfo)element).IsDefined(attributeType, inherit)); }
internal static bool IsDefined(ICustomAttributeProvider element, Type attributeType, bool inherit) { if (attributeType == null) { throw new ArgumentNullException(nameof(attributeType)); } if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute)) { throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass + " " + attributeType.FullName); } return(MonoCustomAttrs.IsDefined(element, attributeType, inherit)); }
public override bool IsDefined(Type attributeType, bool inherit) { return(MonoCustomAttrs.IsDefined(this, attributeType, inherit)); }
static bool InternalIsDefined(PropertyInfo element, Type attributeType, bool inherit) { return(MonoCustomAttrs.IsDefined(element, attributeType, inherit)); }
public static bool IsDefined(ParameterInfo element, Type attributeType, bool inherit) => MonoCustomAttrs.IsDefined(element, attributeType, inherit);
public static bool IsDefined(ParameterInfo element, Type attributeType) => MonoCustomAttrs.IsDefined(element, attributeType, true);
public static bool IsDefined(Module element, Type attributeType, bool inherit) => MonoCustomAttrs.IsDefined(element, attributeType, inherit);
public static bool IsDefined(Module element, Type attributeType) => MonoCustomAttrs.IsDefined(element, attributeType, true);