System.Attribute.GetCustomAttributes C# (CSharp) Method

GetCustomAttributes() public static method

public static GetCustomAttributes ( ParameterInfo element, Type attributeType, bool inherit ) : Attribute[]
element ParameterInfo
attributeType Type
inherit bool
return Attribute[]
        public static Attribute[] GetCustomAttributes(ParameterInfo element, Type attributeType, bool inherit)
        {
            if (element == null)
                throw new ArgumentNullException("element");

            if (attributeType == null)
                throw new ArgumentNullException("attributeType");
            
            if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
                throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));

            MemberInfo member = element.Member;

            if (member.MemberType == MemberTypes.Method && inherit) 
                return InternalParamGetCustomAttributes((MethodInfo)member, element, attributeType, inherit) as Attribute[];

            return element.GetCustomAttributes(attributeType, inherit) as Attribute[];
        }

Same methods

Attribute::GetCustomAttributes ( Assembly element ) : System.Attribute[]
Attribute::GetCustomAttributes ( Assembly element, Type attributeType ) : System.Attribute[]
Attribute::GetCustomAttributes ( Assembly element, Type attributeType, bool inherit ) : System.Attribute[]
Attribute::GetCustomAttributes ( Assembly element, bool inherit ) : System.Attribute[]
Attribute::GetCustomAttributes ( MemberInfo element ) : Attribute[]
Attribute::GetCustomAttributes ( MemberInfo element, Type type ) : Attribute[]
Attribute::GetCustomAttributes ( MemberInfo element, Type type, bool inherit ) : Attribute[]
Attribute::GetCustomAttributes ( MemberInfo element, bool inherit ) : Attribute[]
Attribute::GetCustomAttributes ( Module element ) : Attribute[]
Attribute::GetCustomAttributes ( Module element, Type attributeType ) : Attribute[]
Attribute::GetCustomAttributes ( Module element, Type attributeType, bool inherit ) : Attribute[]
Attribute::GetCustomAttributes ( Module element, bool inherit ) : Attribute[]
Attribute::GetCustomAttributes ( ParameterInfo element ) : Attribute[]
Attribute::GetCustomAttributes ( ParameterInfo element, Type attributeType ) : Attribute[]
Attribute::GetCustomAttributes ( ParameterInfo element, bool inherit ) : Attribute[]

Usage Example

Beispiel #1
0
 public static Attribute[] GetCustomAttributes(Assembly element)
 {
     return(Attribute.GetCustomAttributes(element, true));
 }
All Usage Examples Of System.Attribute::GetCustomAttributes