CustomAttributeExtensions.IsDefined Méthode

Définition

Indique si les attributs personnalisés sont appliqués à un élément.

Surcharges

IsDefined(MemberInfo, Type, Boolean)

Indique si les attributs personnalisés d'un type spécifié sont appliqués à un membre spécifié, et, éventuellement, appliqués à ses ancêtres.

IsDefined(Assembly, Type)

Indique si des attributs personnalisés d'un type spécifié sont appliqués à un assembly spécifié.

IsDefined(MemberInfo, Type)

Indique si des attributs personnalisés d'un type spécifié sont appliqués à un membre spécifié.

IsDefined(Module, Type)

Indique si des attributs personnalisés d'un type spécifié sont appliqués à un module spécifié.

IsDefined(ParameterInfo, Type)

Indique si des attributs personnalisés d'un type spécifié sont appliqués à un paramètre spécifié.

IsDefined(ParameterInfo, Type, Boolean)

Indique si les attributs personnalisés d'un type spécifié sont appliqués à un paramètre spécifié, et, éventuellement, appliqués à ses ancêtres.

IsDefined(MemberInfo, Type, Boolean)

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

Indique si les attributs personnalisés d'un type spécifié sont appliqués à un membre spécifié, et, éventuellement, appliqués à ses ancêtres.

C#
public static bool IsDefined (this System.Reflection.MemberInfo element, Type attributeType, bool inherit);

Paramètres

element
MemberInfo

Membre à inspecter.

attributeType
Type

Type de l'attribut à rechercher.

inherit
Boolean

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

Retours

true si un attribut du type spécifié est appliqué à element ; sinon, false.

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.

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

IsDefined(Assembly, Type)

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

Indique si des attributs personnalisés d'un type spécifié sont appliqués à un assembly spécifié.

C#
public static bool IsDefined (this System.Reflection.Assembly element, Type attributeType);

Paramètres

element
Assembly

Assembly à inspecter.

attributeType
Type

Type de l'attribut à rechercher.

Retours

true si un attribut du type spécifié est appliqué à element ; sinon, false.

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

IsDefined(MemberInfo, Type)

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

Indique si des attributs personnalisés d'un type spécifié sont appliqués à un membre spécifié.

C#
public static bool IsDefined (this System.Reflection.MemberInfo element, Type attributeType);

Paramètres

element
MemberInfo

Membre à inspecter.

attributeType
Type

Type d’attribut à rechercher.

Retours

true si un attribut du type spécifié est appliqué à element ; sinon, false.

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.

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

IsDefined(Module, Type)

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

Indique si des attributs personnalisés d'un type spécifié sont appliqués à un module spécifié.

C#
public static bool IsDefined (this System.Reflection.Module element, Type attributeType);

Paramètres

element
Module

Module à inspecter.

attributeType
Type

Type d’attribut à rechercher.

Retours

true si un attribut du type spécifié est appliqué à element ; sinon, false.

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

IsDefined(ParameterInfo, Type)

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

Indique si des attributs personnalisés d'un type spécifié sont appliqués à un paramètre spécifié.

C#
public static bool IsDefined (this System.Reflection.ParameterInfo element, Type attributeType);

Paramètres

element
ParameterInfo

Paramètre à inspecter.

attributeType
Type

Type d’attribut à rechercher.

Retours

true si un attribut du type spécifié est appliqué à element ; sinon, false.

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

IsDefined(ParameterInfo, Type, Boolean)

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

Indique si les attributs personnalisés d'un type spécifié sont appliqués à un paramètre spécifié, et, éventuellement, appliqués à ses ancêtres.

C#
public static bool IsDefined (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

true si un attribut du type spécifié est appliqué à element ; sinon, false.

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