共用方式為


PropertyBuilder.IsDefined Method

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

Indicates whether one or more instances of attributeType are defined on this property. This method is not supported.

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

Syntax

'Declaration
Public Overrides Function IsDefined ( _
    attributeType As Type, _
    inherit As Boolean _
) As Boolean
public override bool IsDefined(
    Type attributeType,
    bool inherit
)

Parameters

  • attributeType
    Type: System.Type
    The object to which the custom attributes are applied.
  • inherit
    Type: System.Boolean
    true to walk up this property's inheritance chain to find the custom attributes; otherwise, false.

Return Value

Type: System.Boolean
true if one or more instances of attributeType are defined on this property; otherwise false.

Implements

ICustomAttributeProvider.IsDefined(Type, Boolean)

Exceptions

Exception Condition
NotSupportedException

This method is not supported.

Remarks

To determine whether a custom attribute has been applied to 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 IsDefined on the PropertyInfo.

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.