private static bool InternalParamIsDefined(MethodInfo method, ParameterInfo param, Type type, bool inherit)
{
if (param.IsDefined(type, false))
{
return(true);
}
if (method.DeclaringType == null || !inherit)
{
return(false);
}
int position = param.Position;
for (method = method.GetParentDefinition(); method != null; method = method.GetParentDefinition())
{
param = method.GetParameters()[position];
object[] customAttributes = param.GetCustomAttributes(type, false);
for (int index = 0; index < customAttributes.Length; ++index)
{
AttributeUsageAttribute attributeUsage = Attribute.InternalGetAttributeUsage(customAttributes[index].GetType());
if (customAttributes[index] is Attribute && attributeUsage.Inherited)
{
return(true);
}
}
}
return(false);
}