public static bool IsDefined(ParameterInfo element, Type attributeType, bool inherit)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
if (attributeType == (Type)null)
{
throw new ArgumentNullException("attributeType");
}
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
{
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
}
switch (element.Member.MemberType)
{
case MemberTypes.Constructor:
return(element.IsDefined(attributeType, false));
case MemberTypes.Method:
return(Attribute.InternalParamIsDefined(element, attributeType, inherit));
case MemberTypes.Property:
return(element.IsDefined(attributeType, false));
default:
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParamInfo"));
}
}