MethodBuilder.SetCustomAttribute Méthode

Définition

Définit un attribut personnalisé.

Surcharges

Nom Description
SetCustomAttribute(CustomAttributeBuilder)

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

SetCustomAttribute(ConstructorInfo, Byte[])

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

SetCustomAttribute(CustomAttributeBuilder)

Source:
MethodBuilder.cs
Source:
MethodBuilder.cs
Source:
MethodBuilder.cs
Source:
MethodBuilder.cs
Source:
MethodBuilder.cs

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

public:
 void SetCustomAttribute(System::Reflection::Emit::CustomAttributeBuilder ^ customBuilder);
public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder);
member this.SetCustomAttribute : System.Reflection.Emit.CustomAttributeBuilder -> unit
Public Sub SetCustomAttribute (customBuilder As CustomAttributeBuilder)

Paramètres

customBuilder
CustomAttributeBuilder

Instance d’une classe d’assistance pour décrire l’attribut personnalisé.

Exceptions

customBuilder a la valeur null.

Pour la méthode actuelle, la IsGenericMethod propriété est true, mais la IsGenericMethodDefinition propriété est false.

Remarques

La SetCustomAttribute méthode peut interagir avec la SetImplementationFlags méthode lorsque les deux méthodes sont utilisées en combinaison. Pour plus d’informations, consultez la section Remarques de la SetImplementationFlags méthode.

S’applique à

SetCustomAttribute(ConstructorInfo, Byte[])

Source:
MethodBuilder.cs
Source:
MethodBuilder.cs
Source:
MethodBuilder.cs
Source:
MethodBuilder.cs
Source:
MethodBuilder.cs

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

public:
 void SetCustomAttribute(System::Reflection::ConstructorInfo ^ con, cli::array <System::Byte> ^ binaryAttribute);
public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute);
[System.Runtime.InteropServices.ComVisible(true)]
public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute);
member this.SetCustomAttribute : System.Reflection.ConstructorInfo * byte[] -> unit
[<System.Runtime.InteropServices.ComVisible(true)>]
member this.SetCustomAttribute : System.Reflection.ConstructorInfo * byte[] -> unit
Public Sub SetCustomAttribute (con As ConstructorInfo, binaryAttribute As Byte())

Paramètres

con
ConstructorInfo

Constructeur de l’attribut personnalisé.

binaryAttribute
Byte[]

Objet blob d’octets représentant les attributs.

Attributs

Exceptions

con ou binaryAttribute est null.

Pour la méthode actuelle, la IsGenericMethod propriété est true, mais la IsGenericMethodDefinition propriété est false.

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).

La SetCustomAttribute méthode peut interagir avec la SetImplementationFlags méthode lorsque les deux méthodes sont utilisées en combinaison. Pour plus d’informations, consultez la section Remarques de la SetImplementationFlags méthode.

S’applique à