CustomAttributeExtensions.IsDefined Method

Definition

Indicates whether custom attributes are applied to an element.

Overloads

IsDefined(MemberInfo, Type, Boolean)

Indicates whether custom attributes of a specified type are applied to a specified member, and, optionally, applied to its ancestors.

IsDefined(Assembly, Type)

Indicates whether custom attributes of a specified type are applied to a specified assembly.

IsDefined(MemberInfo, Type)

Indicates whether custom attributes of a specified type are applied to a specified member.

IsDefined(Module, Type)

Indicates whether custom attributes of a specified type are applied to a specified module.

IsDefined(ParameterInfo, Type)

Indicates whether custom attributes of a specified type are applied to a specified parameter.

IsDefined(ParameterInfo, Type, Boolean)

Indicates whether custom attributes of a specified type are applied to a specified parameter, and, optionally, applied to its ancestors.

IsDefined(MemberInfo, Type, Boolean)

Indicates whether custom attributes of a specified type are applied to a specified member, and, optionally, applied to its ancestors.

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::MemberInfo ^ element, Type ^ attributeType, bool inherit);
public static bool IsDefined (this System.Reflection.MemberInfo element, Type attributeType, bool inherit);
static member IsDefined : System.Reflection.MemberInfo * Type * bool -> bool
<Extension()>
Public Function IsDefined (element As MemberInfo, attributeType As Type, inherit As Boolean) As Boolean

Parameters

element
MemberInfo

The member to inspect.

attributeType
Type

The type of the attribute to search for.

inherit
Boolean

true to inspect the ancestors of element; otherwise, false.

Returns

true if an attribute of the specified type is applied to element; otherwise, false.

Exceptions

element or attributeType is null.

attributeType is not derived from Attribute.

element is not a constructor, method, property, event, type, or field.

IsDefined(Assembly, Type)

Indicates whether custom attributes of a specified type are applied to a specified assembly.

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::Assembly ^ element, Type ^ attributeType);
public static bool IsDefined (this System.Reflection.Assembly element, Type attributeType);
static member IsDefined : System.Reflection.Assembly * Type -> bool
<Extension()>
Public Function IsDefined (element As Assembly, attributeType As Type) As Boolean

Parameters

element
Assembly

The assembly to inspect.

attributeType
Type

The type of the attribute to search for.

Returns

true if an attribute of the specified type is applied to element; otherwise, false.

Exceptions

element or attributeType is null.

attributeType is not derived from Attribute.

IsDefined(MemberInfo, Type)

Indicates whether custom attributes of a specified type are applied to a specified member.

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::MemberInfo ^ element, Type ^ attributeType);
public static bool IsDefined (this System.Reflection.MemberInfo element, Type attributeType);
static member IsDefined : System.Reflection.MemberInfo * Type -> bool
<Extension()>
Public Function IsDefined (element As MemberInfo, attributeType As Type) As Boolean

Parameters

element
MemberInfo

The member to inspect.

attributeType
Type

The type of attribute to search for.

Returns

true if an attribute of the specified type is applied to element; otherwise, false.

Exceptions

element or attributeType is null.

attributeType is not derived from Attribute.

element is not a constructor, method, property, event, type, or field.

IsDefined(Module, Type)

Indicates whether custom attributes of a specified type are applied to a specified module.

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::Module ^ element, Type ^ attributeType);
public static bool IsDefined (this System.Reflection.Module element, Type attributeType);
static member IsDefined : System.Reflection.Module * Type -> bool
<Extension()>
Public Function IsDefined (element As Module, attributeType As Type) As Boolean

Parameters

element
Module

The module to inspect.

attributeType
Type

The type of attribute to search for.

Returns

true if an attribute of the specified type is applied to element; otherwise, false.

Exceptions

element or attributeType is null.

attributeType is not derived from Attribute.

IsDefined(ParameterInfo, Type)

Indicates whether custom attributes of a specified type are applied to a specified parameter.

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::ParameterInfo ^ element, Type ^ attributeType);
public static bool IsDefined (this System.Reflection.ParameterInfo element, Type attributeType);
static member IsDefined : System.Reflection.ParameterInfo * Type -> bool
<Extension()>
Public Function IsDefined (element As ParameterInfo, attributeType As Type) As Boolean

Parameters

element
ParameterInfo

The parameter to inspect.

attributeType
Type

The type of attribute to search for.

Returns

true if an attribute of the specified type is applied to element; otherwise, false.

Exceptions

element or attributeType is null.

attributeType is not derived from Attribute.

IsDefined(ParameterInfo, Type, Boolean)

Indicates whether custom attributes of a specified type are applied to a specified parameter, and, optionally, applied to its ancestors.

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDefined(System::Reflection::ParameterInfo ^ element, Type ^ attributeType, bool inherit);
public static bool IsDefined (this System.Reflection.ParameterInfo element, Type attributeType, bool inherit);
static member IsDefined : System.Reflection.ParameterInfo * Type * bool -> bool
<Extension()>
Public Function IsDefined (element As ParameterInfo, attributeType As Type, inherit As Boolean) As Boolean

Parameters

element
ParameterInfo

The parameter to inspect.

attributeType
Type

The type of attribute to search for.

inherit
Boolean

true to inspect the ancestors of element; otherwise, false.

Returns

true if an attribute of the specified type is applied to element; otherwise, false.

Exceptions

element or attributeType is null.

attributeType is not derived from Attribute.

Applies to