InternalParamGetCustomAttributes() private static method

private static InternalParamGetCustomAttributes ( MethodInfo method, ParameterInfo param, Type type, bool inherit ) : Attribute[]
method MethodInfo
param ParameterInfo
type Type
inherit bool
return Attribute[]
Ejemplo n.º 1
0
 public static Attribute[] GetCustomAttributes(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"));
     }
     if (element.Member == (MemberInfo)null)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParameterInfo"), "element");
     }
     if (element.Member.MemberType == MemberTypes.Method && inherit)
     {
         return(Attribute.InternalParamGetCustomAttributes(element, attributeType, inherit));
     }
     else
     {
         return(element.GetCustomAttributes(attributeType, inherit) as Attribute[]);
     }
 }
Ejemplo n.º 2
0
        public static Attribute[] GetCustomAttributes(ParameterInfo element, bool inherit)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            MemberInfo member = element.Member;

            if (member.MemberType == MemberTypes.Method && inherit)
            {
                return(Attribute.InternalParamGetCustomAttributes((MethodInfo)member, element, (Type)null, inherit));
            }
            else
            {
                return(element.GetCustomAttributes(typeof(Attribute), inherit) as Attribute[]);
            }
        }
Ejemplo n.º 3
0
 public static Attribute[] GetCustomAttributes(ParameterInfo element, bool inherit)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     if (element.Member == (MemberInfo)null)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParameterInfo"), "element");
     }
     if (element.Member.MemberType == MemberTypes.Method && inherit)
     {
         return(Attribute.InternalParamGetCustomAttributes(element, (Type)null, inherit));
     }
     else
     {
         return(element.GetCustomAttributes(typeof(Attribute), inherit) as Attribute[]);
     }
 }