MethodBuilder.SetCustomAttribute MethodBuilder.SetCustomAttribute MethodBuilder.SetCustomAttribute MethodBuilder.SetCustomAttribute Method

Definition

Sets a custom attribute.

Overloads

SetCustomAttribute(ConstructorInfo, Byte[]) SetCustomAttribute(ConstructorInfo, Byte[]) SetCustomAttribute(ConstructorInfo, Byte[]) SetCustomAttribute(ConstructorInfo, Byte[])

Sets a custom attribute using a specified custom attribute blob.

SetCustomAttribute(CustomAttributeBuilder) SetCustomAttribute(CustomAttributeBuilder) SetCustomAttribute(CustomAttributeBuilder) SetCustomAttribute(CustomAttributeBuilder)

Sets a custom attribute using a custom attribute builder.

SetCustomAttribute(ConstructorInfo, Byte[]) SetCustomAttribute(ConstructorInfo, Byte[]) SetCustomAttribute(ConstructorInfo, Byte[]) SetCustomAttribute(ConstructorInfo, Byte[])

Sets a custom attribute using a specified custom attribute blob.

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

Parameters

con
ConstructorInfo ConstructorInfo ConstructorInfo ConstructorInfo

The constructor for the custom attribute.

binaryAttribute
Byte[]

A byte blob representing the attributes.

Exceptions

Remarks

For details on how to format binaryAttribute, see the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics". The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

The SetCustomAttribute method can interact with the SetImplementationFlags method when the two methods are used in combination. See the Remarks section of the SetImplementationFlags method for details.

SetCustomAttribute(CustomAttributeBuilder) SetCustomAttribute(CustomAttributeBuilder) SetCustomAttribute(CustomAttributeBuilder) SetCustomAttribute(CustomAttributeBuilder)

Sets a custom attribute using a custom attribute builder.

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)

Parameters

customBuilder
CustomAttributeBuilder CustomAttributeBuilder CustomAttributeBuilder CustomAttributeBuilder

An instance of a helper class to describe the custom attribute.

Exceptions

Remarks

The SetCustomAttribute method can interact with the SetImplementationFlags method when the two methods are used in combination. See the Remarks section of the SetImplementationFlags method for details.

Applies to