TypeBuilder.IsDefined Method

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

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

[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)

ExceptionCondition
NotSupportedException

This method is not currently supported for incomplete types.

ArgumentException

attributeType is not defined.

ArgumentNullException

attributeType is null.

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

Silverlight

Supported in: 5, 4, 3

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

Community Additions

ADD
Show: