CustomAttributeExtensions.GetCustomAttributes 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
检索应用于指定元素的自定义特性集合。
- Source:
- CustomAttributeExtensions.cs
- Source:
- CustomAttributeExtensions.cs
- Source:
- CustomAttributeExtensions.cs
检索应用于指定参数的指定类型的自定义特性集合,并可选择检查该参数的上级。
public:
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::ParameterInfo ^ element, Type ^ attributeType, bool inherit);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.ParameterInfo element, Type attributeType, bool inherit);
static member GetCustomAttributes : System.Reflection.ParameterInfo * Type * bool -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As ParameterInfo, attributeType As Type, inherit As Boolean) As IEnumerable(Of Attribute)
参数
- element
- ParameterInfo
要检查的参数。
- attributeType
- Type
要搜索的属性的类型。
- inherit
- Boolean
如果检查 element
的上级,则为 true
;否则为 false
。
返回
将应用于与 element
并与 attributeType
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::MemberInfo ^ element, Type ^ attributeType, bool inherit);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.MemberInfo element, Type attributeType, bool inherit);
static member GetCustomAttributes : System.Reflection.MemberInfo * Type * bool -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As MemberInfo, attributeType As Type, inherit As Boolean) As IEnumerable(Of Attribute)
参数
- element
- MemberInfo
要检查的成员。
- attributeType
- Type
要搜索的属性的类型。
- inherit
- Boolean
如果检查 element
的上级,则为 true
;否则为 false
。
返回
将应用于与 element
并与 attributeType
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::ParameterInfo ^ element, Type ^ attributeType);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.ParameterInfo element, Type attributeType);
static member GetCustomAttributes : System.Reflection.ParameterInfo * Type -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As ParameterInfo, attributeType As Type) As IEnumerable(Of Attribute)
参数
- element
- ParameterInfo
要检查的参数。
- attributeType
- Type
要搜索的属性的类型。
返回
将应用于与 element
并与 attributeType
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::ParameterInfo ^ element, bool inherit);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.ParameterInfo element, bool inherit);
static member GetCustomAttributes : System.Reflection.ParameterInfo * bool -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As ParameterInfo, inherit As Boolean) As IEnumerable(Of Attribute)
参数
- element
- ParameterInfo
要检查的参数。
- inherit
- Boolean
如果检查 element
的上级,则为 true
;否则为 false
。
返回
将应用于 element
的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::Module ^ element, Type ^ attributeType);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.Module element, Type attributeType);
static member GetCustomAttributes : System.Reflection.Module * Type -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As Module, attributeType As Type) As IEnumerable(Of Attribute)
参数
- element
- Module
要检查的模块。
- attributeType
- Type
要搜索的属性的类型。
返回
将应用于与 element
并与 attributeType
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::MemberInfo ^ element, Type ^ attributeType);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.MemberInfo element, Type attributeType);
static member GetCustomAttributes : System.Reflection.MemberInfo * Type -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As MemberInfo, attributeType As Type) As IEnumerable(Of Attribute)
参数
- element
- MemberInfo
要检查的成员。
- attributeType
- Type
要搜索的属性的类型。
返回
将应用于与 element
并与 attributeType
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::MemberInfo ^ element, bool inherit);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.MemberInfo element, bool inherit);
static member GetCustomAttributes : System.Reflection.MemberInfo * bool -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As MemberInfo, inherit As Boolean) As IEnumerable(Of Attribute)
参数
- element
- MemberInfo
要检查的成员。
- inherit
- Boolean
如果检查 element
的上级,则为 true
;否则为 false
。
返回
将应用于与指定的条件匹配的 element
的自定义特性的集合,如果此类特性不存在,则为空集。
例外
element
为 null
。
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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::Assembly ^ element, Type ^ attributeType);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.Assembly element, Type attributeType);
static member GetCustomAttributes : System.Reflection.Assembly * Type -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As Assembly, attributeType As Type) As IEnumerable(Of Attribute)
参数
- element
- Assembly
要检查的程序集。
- attributeType
- Type
要搜索的属性的类型。
返回
将应用于与 element
并与 attributeType
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::ParameterInfo ^ element);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.ParameterInfo element);
static member GetCustomAttributes : System.Reflection.ParameterInfo -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As ParameterInfo) As IEnumerable(Of Attribute)
参数
- element
- ParameterInfo
要检查的参数。
返回
将应用于 element
的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::Module ^ element);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.Module element);
static member GetCustomAttributes : System.Reflection.Module -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As Module) As IEnumerable(Of Attribute)
参数
- element
- Module
要检查的模块。
返回
将应用于 element
的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
适用于
.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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::MemberInfo ^ element);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.MemberInfo element);
static member GetCustomAttributes : System.Reflection.MemberInfo -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As MemberInfo) As IEnumerable(Of Attribute)
参数
- element
- MemberInfo
要检查的成员。
返回
将应用于 element
的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
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 System::Collections::Generic::IEnumerable<Attribute ^> ^ GetCustomAttributes(System::Reflection::Assembly ^ element);
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.Assembly element);
static member GetCustomAttributes : System.Reflection.Assembly -> seq<Attribute>
<Extension()>
Public Function GetCustomAttributes (element As Assembly) As IEnumerable(Of Attribute)
参数
- element
- Assembly
要检查的程序集。
返回
将应用于 element
的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
适用于
.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:
generic <typename T>
where T : Attribute[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable<T> ^ GetCustomAttributes(System::Reflection::ParameterInfo ^ element, bool inherit);
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.ParameterInfo element, bool inherit) where T : Attribute;
static member GetCustomAttributes : System.Reflection.ParameterInfo * bool -> seq<'T (requires 'T :> Attribute)> (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttributes(Of T As Attribute) (element As ParameterInfo, inherit As Boolean) As IEnumerable(Of T)
类型参数
- T
要搜索的属性的类型。
参数
- element
- ParameterInfo
要检查的参数。
- inherit
- Boolean
如果检查 element
的上级,则为 true
;否则为 false
。
返回
将应用于与 element
并与 T
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
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:
generic <typename T>
where T : Attribute[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable<T> ^ GetCustomAttributes(System::Reflection::MemberInfo ^ element, bool inherit);
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.MemberInfo element, bool inherit) where T : Attribute;
static member GetCustomAttributes : System.Reflection.MemberInfo * bool -> seq<'T (requires 'T :> Attribute)> (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttributes(Of T As Attribute) (element As MemberInfo, inherit As Boolean) As IEnumerable(Of T)
类型参数
- T
要搜索的属性的类型。
参数
- element
- MemberInfo
要检查的成员。
- inherit
- Boolean
如果检查 element
的上级,则为 true
;否则为 false
。
返回
将应用于与 element
并与 T
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
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:
generic <typename T>
where T : Attribute[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable<T> ^ GetCustomAttributes(System::Reflection::ParameterInfo ^ element);
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.ParameterInfo element) where T : Attribute;
static member GetCustomAttributes : System.Reflection.ParameterInfo -> seq<'T (requires 'T :> Attribute)> (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttributes(Of T As Attribute) (element As ParameterInfo) As IEnumerable(Of T)
类型参数
- T
要搜索的属性的类型。
参数
- element
- ParameterInfo
要检查的参数。
返回
将应用于与 element
并与 T
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
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:
generic <typename T>
where T : Attribute[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable<T> ^ GetCustomAttributes(System::Reflection::MemberInfo ^ element);
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.MemberInfo element) where T : Attribute;
static member GetCustomAttributes : System.Reflection.MemberInfo -> seq<'T (requires 'T :> Attribute)> (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttributes(Of T As Attribute) (element As MemberInfo) As IEnumerable(Of T)
类型参数
- T
要搜索的属性的类型。
参数
- element
- MemberInfo
要检查的成员。
返回
将应用于与 element
并与 T
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
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:
generic <typename T>
where T : Attribute[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable<T> ^ GetCustomAttributes(System::Reflection::Assembly ^ element);
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.Assembly element) where T : Attribute;
static member GetCustomAttributes : System.Reflection.Assembly -> seq<'T (requires 'T :> Attribute)> (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttributes(Of T As Attribute) (element As Assembly) As IEnumerable(Of T)
类型参数
- T
要搜索的属性的类型。
参数
- element
- Assembly
要检查的程序集。
返回
将应用于与 element
并与 T
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
适用于
.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:
generic <typename T>
where T : Attribute[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable<T> ^ GetCustomAttributes(System::Reflection::Module ^ element);
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.Module element) where T : Attribute;
static member GetCustomAttributes : System.Reflection.Module -> seq<'T (requires 'T :> Attribute)> (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttributes(Of T As Attribute) (element As Module) As IEnumerable(Of T)
类型参数
- T
要搜索的属性的类型。
参数
- element
- Module
要检查的模块。
返回
将应用于与 element
并与 T
匹配的自定义特性的集合,如果此类特性不存在,则为空集合。
例外
element
为 null
。
适用于
.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 |