CustomAttributeExtensions.IsDefined 方法

定义

指示是否将自定义属性应用于元素。Indicates whether custom attributes are applied to an element.

重载

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

参数

element
MemberInfo

要检查的成员。The member to inspect.

attributeType
Type

要搜索的特性类型。The type of the attribute to search for.

inherit
Boolean

如果检查 element 的上级,则为 true;否则为 falsetrue to inspect the ancestors of element; otherwise, false.

返回

如果将指定类型的特性应用于 element,则为 true;否则为 falsetrue if an attribute of the specified type is applied to element; otherwise, false.

异常

elementattributeTypenullelement or attributeType is null.

attributeType 不是从 Attribute 派生的。attributeType is not derived from Attribute.

element 不是构造函数、方法、属性、事件、类型或字段。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

参数

element
Assembly

要检查的程序集。The assembly to inspect.

attributeType
Type

要搜索的特性类型。The type of the attribute to search for.

返回

如果将指定类型的特性应用于 element,则为 true;否则为 falsetrue if an attribute of the specified type is applied to element; otherwise, false.

异常

elementattributeTypenullelement or attributeType is null.

attributeType 不是从 Attribute 派生的。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

参数

element
MemberInfo

要检查的成员。The member to inspect.

attributeType
Type

要搜索的属性的类型。The type of attribute to search for.

返回

如果将指定类型的特性应用于 element,则为 true;否则为 falsetrue if an attribute of the specified type is applied to element; otherwise, false.

异常

elementattributeTypenullelement or attributeType is null.

attributeType 不是从 Attribute 派生的。attributeType is not derived from Attribute.

element 不是构造函数、方法、属性、事件、类型或字段。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

参数

element
Module

要检查的模块。The module to inspect.

attributeType
Type

要搜索的属性的类型。The type of attribute to search for.

返回

如果将指定类型的特性应用于 element,则为 true;否则为 falsetrue if an attribute of the specified type is applied to element; otherwise, false.

异常

elementattributeTypenullelement or attributeType is null.

attributeType 不是从 Attribute 派生的。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

参数

element
ParameterInfo

要检查的参数。The parameter to inspect.

attributeType
Type

要搜索的属性的类型。The type of attribute to search for.

返回

如果将指定类型的特性应用于 element,则为 true;否则为 falsetrue if an attribute of the specified type is applied to element; otherwise, false.

异常

elementattributeTypenullelement or attributeType is null.

attributeType 不是从 Attribute 派生的。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

参数

element
ParameterInfo

要检查的参数。The parameter to inspect.

attributeType
Type

要搜索的属性的类型。The type of attribute to search for.

inherit
Boolean

如果检查 element 的上级,则为 true;否则为 falsetrue to inspect the ancestors of element; otherwise, false.

返回

如果将指定类型的特性应用于 element,则为 true;否则为 falsetrue if an attribute of the specified type is applied to element; otherwise, false.

异常

elementattributeTypenullelement or attributeType is null.

attributeType 不是从 Attribute 派生的。attributeType is not derived from Attribute.

适用于