CustomAttributeExtensions.GetCustomAttributes Méthode

Définition

Récupère une collection d'attributs personnalisés qui sont appliqués à un élément spécifié.

Surcharges

GetCustomAttributes(ParameterInfo, Type, Boolean)

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un paramètre spécifié, et inspecte éventuellement les ancêtres de ce paramètre.

GetCustomAttributes(MemberInfo, Type, Boolean)

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

GetCustomAttributes(ParameterInfo, Type)

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un paramètre spécifié.

GetCustomAttributes(ParameterInfo, Boolean)

Récupère une collection d'attributs personnalisés qui sont appliqués à un paramètre spécifié, et inspecte éventuellement les ancêtres de ce paramètre.

GetCustomAttributes(Module, Type)

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un module spécifié.

GetCustomAttributes(MemberInfo, Type)

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié.

GetCustomAttributes(MemberInfo, Boolean)

Récupère une collection d'attributs personnalisés qui sont appliqués à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

GetCustomAttributes(Assembly, Type)

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un assembly spécifié.

GetCustomAttributes(ParameterInfo)

Récupère une collection d'attributs personnalisés qui sont appliqués à un paramètre spécifié.

GetCustomAttributes(Module)

Récupère une collection d'attributs personnalisés qui sont appliqués à un module spécifié.

GetCustomAttributes(MemberInfo)

Récupère une collection d'attributs personnalisés qui sont appliqués à un membre spécifié.

GetCustomAttributes(Assembly)

Récupère une collection d'attributs personnalisés qui sont appliqués à un assembly spécifié.

GetCustomAttributes<T>(ParameterInfo, Boolean)

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un paramètre spécifié, et inspecte éventuellement les ancêtres de ce paramètre.

GetCustomAttributes<T>(MemberInfo, Boolean)

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

GetCustomAttributes<T>(ParameterInfo)

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un paramètre spécifié.

GetCustomAttributes<T>(MemberInfo)

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié.

GetCustomAttributes<T>(Assembly)

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un assembly spécifié.

GetCustomAttributes<T>(Module)

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un module spécifié.

GetCustomAttributes(ParameterInfo, Type, Boolean)

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

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un paramètre spécifié, et inspecte éventuellement les ancêtres de ce paramètre.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.ParameterInfo element, Type attributeType, bool inherit);

Paramètres

element
ParameterInfo

Paramètre à inspecter.

attributeType
Type

Type d’attribut à rechercher.

inherit
Boolean

true pour inspecter les ancêtres de element ; sinon, false.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à attributeType, ou collection vide si aucun attribut n'existe.

Exceptions

element ou attributeType est null.

attributeType n'est pas dérivé de Attribute.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(MemberInfo, Type, Boolean)

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

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.MemberInfo element, Type attributeType, bool inherit);

Paramètres

element
MemberInfo

Membre à inspecter.

attributeType
Type

Type d’attribut à rechercher.

inherit
Boolean

true pour inspecter les ancêtres de element ; sinon, false.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à attributeType, ou collection vide si aucun attribut n'existe.

Exceptions

element ou attributeType est null.

attributeType n'est pas dérivé de Attribute.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(ParameterInfo, Type)

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

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un paramètre spécifié.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.ParameterInfo element, Type attributeType);

Paramètres

element
ParameterInfo

Paramètre à inspecter.

attributeType
Type

Type d’attribut à rechercher.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à attributeType, ou collection vide si aucun attribut n'existe.

Exceptions

element ou attributeType est null.

attributeType n'est pas dérivé de Attribute.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(ParameterInfo, Boolean)

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

Récupère une collection d'attributs personnalisés qui sont appliqués à un paramètre spécifié, et inspecte éventuellement les ancêtres de ce paramètre.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.ParameterInfo element, bool inherit);

Paramètres

element
ParameterInfo

Paramètre à inspecter.

inherit
Boolean

true pour inspecter les ancêtres de element ; sinon, false.

Retours

Collection d'attributs personnalisés qui sont appliqués à element ou à une collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(Module, Type)

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

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un module spécifié.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.Module element, Type attributeType);

Paramètres

element
Module

Module à inspecter.

attributeType
Type

Type d’attribut à rechercher.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à attributeType, ou collection vide si aucun attribut n'existe.

Exceptions

element ou attributeType est null.

attributeType n'est pas dérivé de Attribute.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(MemberInfo, Type)

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

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.MemberInfo element, Type attributeType);

Paramètres

element
MemberInfo

Membre à inspecter.

attributeType
Type

Type d’attribut à rechercher.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à attributeType, ou collection vide si aucun attribut n'existe.

Exceptions

element ou attributeType est null.

attributeType n'est pas dérivé de Attribute.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(MemberInfo, Boolean)

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

Récupère une collection d'attributs personnalisés qui sont appliqués à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.MemberInfo element, bool inherit);

Paramètres

element
MemberInfo

Membre à inspecter.

inherit
Boolean

true pour inspecter les ancêtres de element ; sinon, false.

Retours

Collection des attributs personnalisés qui sont appliqués à element qui correspondent aux critères spécifiés, ou collection vide si aucun de ces attributs n'existe.

Exceptions

element a la valeur null.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(Assembly, Type)

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

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un assembly spécifié.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.Assembly element, Type attributeType);

Paramètres

element
Assembly

Assembly à inspecter.

attributeType
Type

Type d’attribut à rechercher.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à attributeType, ou collection vide si aucun attribut n'existe.

Exceptions

element ou attributeType est null.

attributeType n'est pas dérivé de Attribute.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(ParameterInfo)

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

Récupère une collection d'attributs personnalisés qui sont appliqués à un paramètre spécifié.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.ParameterInfo element);

Paramètres

element
ParameterInfo

Paramètre à inspecter.

Retours

Collection d'attributs personnalisés qui sont appliqués à element ou à une collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(Module)

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

Récupère une collection d'attributs personnalisés qui sont appliqués à un module spécifié.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.Module element);

Paramètres

element
Module

Module à inspecter.

Retours

Collection d'attributs personnalisés qui sont appliqués à element ou à une collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(MemberInfo)

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

Récupère une collection d'attributs personnalisés qui sont appliqués à un membre spécifié.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.MemberInfo element);

Paramètres

element
MemberInfo

Membre à inspecter.

Retours

Collection d'attributs personnalisés qui sont appliqués à element ou à une collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes(Assembly)

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

Récupère une collection d'attributs personnalisés qui sont appliqués à un assembly spécifié.

C#
public static System.Collections.Generic.IEnumerable<Attribute> GetCustomAttributes (this System.Reflection.Assembly element);

Paramètres

element
Assembly

Assembly à inspecter.

Retours

Collection d'attributs personnalisés qui sont appliqués à element ou à une collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes<T>(ParameterInfo, Boolean)

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

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un paramètre spécifié, et inspecte éventuellement les ancêtres de ce paramètre.

C#
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.ParameterInfo element, bool inherit) where T : Attribute;

Paramètres de type

T

Type d’attribut à rechercher.

Paramètres

element
ParameterInfo

Paramètre à inspecter.

inherit
Boolean

true pour inspecter les ancêtres de element ; sinon, false.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à T, ou collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes<T>(MemberInfo, Boolean)

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

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

C#
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.MemberInfo element, bool inherit) where T : Attribute;

Paramètres de type

T

Type d’attribut à rechercher.

Paramètres

element
MemberInfo

Membre à inspecter.

inherit
Boolean

true pour inspecter les ancêtres de element ; sinon, false.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à T, ou collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes<T>(ParameterInfo)

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

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un paramètre spécifié.

C#
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.ParameterInfo element) where T : Attribute;

Paramètres de type

T

Type d’attribut à rechercher.

Paramètres

element
ParameterInfo

Paramètre à inspecter.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à T, ou collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes<T>(MemberInfo)

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

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié.

C#
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.MemberInfo element) where T : Attribute;

Paramètres de type

T

Type d’attribut à rechercher.

Paramètres

element
MemberInfo

Membre à inspecter.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à T, ou collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

element n'est pas un constructeur, une méthode, une propriété, un événement, un type ou un champ.

Un type d’attribut personnalisé ne peut pas être chargé.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes<T>(Assembly)

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

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un assembly spécifié.

C#
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.Assembly element) where T : Attribute;

Paramètres de type

T

Type d’attribut à rechercher.

Paramètres

element
Assembly

Assembly à inspecter.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à T, ou collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

S’applique à

.NET 9 et autres versions
Produit Versions
.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

GetCustomAttributes<T>(Module)

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

Récupère une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un module spécifié.

C#
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T> (this System.Reflection.Module element) where T : Attribute;

Paramètres de type

T

Type d’attribut à rechercher.

Paramètres

element
Module

Module à inspecter.

Retours

Collection d'attributs personnalisés qui sont appliqués à element et qui correspondent à T, ou collection vide si aucun attribut n'existe.

Exceptions

element a la valeur null.

S’applique à

.NET 9 et autres versions
Produit Versions
.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