Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

EnumBuilder::IsDefined Method (Type^, Boolean)

 

Checks if the specified custom attribute type is defined.

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

public:
virtual bool IsDefined(
	Type^ attributeType,
	bool inherit
) override

Parameters

attributeType
Type: System::Type^

The Type object to which the custom attributes are applied.

inherit
Type: System::Boolean

Specifies whether to search this member's inheritance chain to find the attributes.

Return Value

Type: System::Boolean

true if one or more instance of attributeType is defined on this member; otherwise, false.

Exception Condition
NotSupportedException

This method is not currently supported in types that are not complete.

As a workaround, to check if a custom attribute is defined for a finished type, retrieve the type using GetType and call GetCustomAttributes on the returned Type.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Return to top
Show:
© 2017 Microsoft