Udostępnij za pośrednictwem


PropertyBuilder.GetCustomAttributes Method (Type, Boolean)

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

Returns an array of custom attributes identified by Type. This method is not supported.

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

Syntax

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

Parameters

  • attributeType
    Type: System.Type
    An array of custom attributes identified by type.
  • inherit
    Type: System.Boolean
    true to walk up the property's inheritance chain to find the custom attributes; otherwise, false.

Return Value

Type: array<System.Object[]
An array of custom attributes defined on this reflected member, or nulla null reference (Nothing in Visual Basic) if no attributes are defined on this member.

Implements

ICustomAttributeProvider.GetCustomAttributes(Type, Boolean)

Exceptions

Exception Condition
NotSupportedException

This method is not supported.

Remarks

To get the custom attributes of a property, reflect on the property's parent type after the type is completed, using Type.GetType or Assembly.GetType. Retrieve the PropertyInfo object from the type, and call GetCustomAttributes on the PropertyInfo object.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

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