CustomAttributeExtensions.IsDefined 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指示是否将自定义属性应用于元素。
IsDefined(MemberInfo, Type, Boolean) |
指示一个指定类型的自定义特性是否应用于一个指定的数字,并选择性地应用于其的上级。 |
IsDefined(Assembly, Type) |
确定是否将指定类型的任何自定义属性应用于指定的程序集。 |
IsDefined(MemberInfo, Type) |
确定是否将指定类型的任何自定义属性应用于指定的成员。 |
IsDefined(Module, Type) |
确定是否将指定类型的任何自定义属性应用于指定的模块。 |
IsDefined(ParameterInfo, Type) |
确定是否将指定类型的任何自定义属性应用于指定的参数。 |
IsDefined(ParameterInfo, 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
。
例外
element
或 attributeType
为 null
。
attributeType
不是从 Attribute 派生的。
element
不是构造函数、方法、属性、事件、类型或字段。
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
- 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
。
例外
element
或 attributeType
为 null
。
attributeType
不是从 Attribute 派生的。
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
- 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
。
例外
element
或 attributeType
为 null
。
attributeType
不是从 Attribute 派生的。
element
不是构造函数、方法、属性、事件、类型或字段。
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
- 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
。
例外
element
或 attributeType
为 null
。
attributeType
不是从 Attribute 派生的。
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
- 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
。
例外
element
或 attributeType
为 null
。
attributeType
不是从 Attribute 派生的。
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
- 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
。
例外
element
或 attributeType
为 null
。
attributeType
不是从 Attribute 派生的。
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |