GenericTypeParameterBuilder.SetCustomAttribute Méthode

Définition

Définit un attribut personnalisé.

Surcharges

SetCustomAttribute(CustomAttributeBuilder)

Définit un attribut personnalisé à l’aide d’un générateur d’attributs personnalisés.

SetCustomAttribute(ConstructorInfo, Byte[])

Définit un attribut personnalisé à l’aide d’un objet blob d’attribut personnalisé spécifié.

SetCustomAttribute(CustomAttributeBuilder)

Source:
GenericTypeParameterBuilder.cs
Source:
GenericTypeParameterBuilder.cs
Source:
GenericTypeParameterBuilder.cs

Définit un attribut personnalisé à l’aide d’un générateur d’attributs personnalisés.

C#
public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder);

Paramètres

customBuilder
CustomAttributeBuilder

Instance d’une classe d’assistance qui définit l’attribut personnalisé.

Exceptions

customBuilder a la valeur null.

S’applique à

.NET 10 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, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 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 2.0 (package-provided), 2.1

SetCustomAttribute(ConstructorInfo, Byte[])

Source:
GenericTypeParameterBuilder.cs
Source:
GenericTypeParameterBuilder.cs
Source:
GenericTypeParameterBuilder.cs

Définit un attribut personnalisé à l’aide d’un objet blob d’attribut personnalisé spécifié.

C#
public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute);

Paramètres

con
ConstructorInfo

Le constructeur de l’attribut personnalisé.

binaryAttribute
Byte[]

Objet blob d’octets représentant l’attribut.

Exceptions

con a la valeur null.

- ou -

binaryAttribute est une référence Null.

Remarques

Pour plus d’informations sur la mise en formebinaryAttribute, consultez la spécification des métadonnées dans Partition II de la spécification CLI (Common Language Infrastructure).

S’applique à

.NET 10 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, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 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 2.0 (package-provided), 2.1