Freigeben über


TypeBuilder.IsDefined Method

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

Determines whether a custom attribute is applied to the current type.

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

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Overrides Function IsDefined ( _
    attributeType As Type, _
    inherit As Boolean _
) As Boolean
[SecuritySafeCriticalAttribute]
public override bool IsDefined(
    Type attributeType,
    bool inherit
)

Parameters

  • attributeType
    Type: System.Type
    The type of attribute to search for. Only attributes that are assignable to this type are returned.
  • inherit
    Type: System.Boolean
    true to search this member's inheritance chain to find the attributes; otherwise, false.

Return Value

Type: System.Boolean
true if one or more instances of attributeType, or an attribute derived from attributeType, is defined on this type; otherwise, false.

Implements

ICustomAttributeProvider.IsDefined(Type, Boolean)

Exceptions

Exception Condition
NotSupportedException

This method is not currently supported for incomplete types.

ArgumentException

attributeType is not defined.

ArgumentNullException

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

Remarks

This method is not supported for incomplete types. Get the completed type by calling CreateType, and use reflection on the completed type.

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.