MethodBuilder.SetCustomAttribute Metodo

Definizione

Imposta un attributo personalizzato.

Overload

Nome Descrizione
SetCustomAttribute(ConstructorInfo, Byte[])

Imposta un attributo personalizzato usando un BLOB di attributi personalizzato specificato.

SetCustomAttribute(CustomAttributeBuilder)

Imposta un attributo personalizzato usando un generatore di attributi personalizzato.

SetCustomAttribute(ConstructorInfo, Byte[])

Imposta un attributo personalizzato usando un BLOB di attributi personalizzato specificato.

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

Parametri

con
ConstructorInfo

Costruttore per l'attributo personalizzato.

binaryAttribute
Byte[]

BLOB di byte che rappresenta gli attributi.

Attributi

Eccezioni

con o binaryAttribute è null.

Per il metodo corrente, la IsGenericMethod proprietà è true, ma la IsGenericMethodDefinition proprietà è false.

Commenti

Per informazioni su come formattare binaryAttribute, vedere la specifica dei metadati in Partition II della specifica Common Language Infrastructure (CLI).

Il SetCustomAttribute metodo può interagire con il SetImplementationFlags metodo quando i due metodi vengono usati in combinazione. Per informazioni dettagliate, vedere la sezione Osservazioni del SetImplementationFlags metodo .

Si applica a

SetCustomAttribute(CustomAttributeBuilder)

Imposta un attributo personalizzato usando un generatore di attributi personalizzato.

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)

Parametri

customBuilder
CustomAttributeBuilder

Istanza di una classe helper per descrivere l'attributo personalizzato.

Eccezioni

customBuilder è null.

Per il metodo corrente, la IsGenericMethod proprietà è true, ma la IsGenericMethodDefinition proprietà è false.

Commenti

Il SetCustomAttribute metodo può interagire con il SetImplementationFlags metodo quando i due metodi vengono usati in combinazione. Per informazioni dettagliate, vedere la sezione Osservazioni del SetImplementationFlags metodo .

Si applica a