Share via


CustomAttributeExtensions.IsDefined 方法

定义

指示是否将自定义属性应用于元素。

重载

IsDefined(MemberInfo, Type, Boolean)

指示一个指定类型的自定义特性是否应用于一个指定的数字,并选择性地应用于其的上级。

IsDefined(Assembly, Type)

确定是否将指定类型的任何自定义属性应用于指定的程序集。

IsDefined(MemberInfo, Type)

确定是否将指定类型的任何自定义属性应用于指定的成员。

IsDefined(Module, Type)

确定是否将指定类型的任何自定义属性应用于指定的模块。

IsDefined(ParameterInfo, Type)

确定是否将指定类型的任何自定义属性应用于指定的参数。

IsDefined(ParameterInfo, Type, Boolean)

指示一个指定类型的自定义特性是否应用于一个指定的参数,并选择性地应用于其的上级。

IsDefined(MemberInfo, Type, Boolean)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

指示一个指定类型的自定义特性是否应用于一个指定的数字,并选择性地应用于其的上级。

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

参数

element
MemberInfo

要检查的成员。

attributeType
Type

要搜索的特性类型。

inherit
Boolean

如果检查 element 的上级,则为 true;否则为 false

返回

如果将指定类型的特性应用于 element,则为 true;否则为 false

例外

elementattributeTypenull

attributeType 不是从 Attribute 派生的。

element 不是构造函数、方法、属性、事件、类型或字段。

适用于

IsDefined(Assembly, Type)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

确定是否将指定类型的任何自定义属性应用于指定的程序集。

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

参数

element
Assembly

要检查的程序集。

attributeType
Type

要搜索的特性类型。

返回

如果将指定类型的特性应用于 element,则为 true;否则为 false

例外

elementattributeTypenull

attributeType 不是从 Attribute 派生的。

适用于

IsDefined(MemberInfo, Type)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

确定是否将指定类型的任何自定义属性应用于指定的成员。

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

参数

element
MemberInfo

要检查的成员。

attributeType
Type

要搜索的属性的类型。

返回

如果将指定类型的特性应用于 element,则为 true;否则为 false

例外

elementattributeTypenull

attributeType 不是从 Attribute 派生的。

element 不是构造函数、方法、属性、事件、类型或字段。

适用于

IsDefined(Module, Type)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

确定是否将指定类型的任何自定义属性应用于指定的模块。

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

参数

element
Module

要检查的模块。

attributeType
Type

要搜索的属性的类型。

返回

如果将指定类型的特性应用于 element,则为 true;否则为 false

例外

elementattributeTypenull

attributeType 不是从 Attribute 派生的。

适用于

IsDefined(ParameterInfo, Type)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

确定是否将指定类型的任何自定义属性应用于指定的参数。

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

参数

element
ParameterInfo

要检查的参数。

attributeType
Type

要搜索的属性的类型。

返回

如果将指定类型的特性应用于 element,则为 true;否则为 false

例外

elementattributeTypenull

attributeType 不是从 Attribute 派生的。

适用于

IsDefined(ParameterInfo, Type, Boolean)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

指示一个指定类型的自定义特性是否应用于一个指定的参数,并选择性地应用于其的上级。

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

参数

element
ParameterInfo

要检查的参数。

attributeType
Type

要搜索的属性的类型。

inherit
Boolean

如果检查 element 的上级,则为 true;否则为 false

返回

如果将指定类型的特性应用于 element,则为 true;否则为 false

例外

elementattributeTypenull

attributeType 不是从 Attribute 派生的。

适用于