共用方式為


ParameterInfo.GetCustomAttributes Method (Type, Boolean)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the custom attributes of the specified type or its derived types that are applied to this parameter.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overridable Function GetCustomAttributes ( _
    attributeType As Type, _
    inherit As Boolean _
) As Object()
public virtual Object[] GetCustomAttributes(
    Type attributeType,
    bool inherit
)

Parameters

  • attributeType
    Type: System.Type
    The custom attributes identified by type.
  • inherit
    Type: System.Boolean
    This parameter is ignored for objects of this type. See Remarks.

Return Value

Type: array<System.Object[]
An array that contains all the custom attributes that are defined on this parameter and that are of the specified type or any of its subtypes.

Implements

ICustomAttributeProvider.GetCustomAttributes(Type, Boolean)

Exceptions

Exception Condition
ArgumentException

The type must be a type provided by the underlying runtime system.

ArgumentNullException

attributeType is nulla null reference (Nothing in Visual Basic).

TypeLoadException

A custom attribute type could not be loaded.

Remarks

This method ignores the inherit parameter. To search the inheritance chain for attributes on parameters, use the appropriate overloads of the Attribute.GetCustomAttributes method.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.