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);
}