संपादित करें

इसके माध्यम से साझा किया गया


PropertyBuilder.SetCustomAttribute Method

Definition

Sets a custom attribute.

Overloads

SetCustomAttribute(CustomAttributeBuilder)

Set a custom attribute using a custom attribute builder.

SetCustomAttribute(ConstructorInfo, Byte[])

Set a custom attribute using a specified custom attribute blob.

SetCustomAttribute(CustomAttributeBuilder)

Source:
PropertyBuilder.cs
Source:
PropertyBuilder.cs
Source:
PropertyBuilder.cs

Set 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

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

Exceptions

customBuilder is null.

if CreateType() has been called on the enclosing type.

Applies to

SetCustomAttribute(ConstructorInfo, Byte[])

Source:
PropertyBuilder.cs
Source:
PropertyBuilder.cs
Source:
PropertyBuilder.cs

Set a custom attribute using a specified custom attribute blob.

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

Parameters

con
ConstructorInfo

The constructor for the custom attribute.

binaryAttribute
Byte[]

A byte blob representing the attributes.

Attributes

Exceptions

con or binaryAttribute is null.

CreateType() has been called on the enclosing type.

Remarks

For information on how to format binaryAttribute, see the metadata specification in Partition II of ECMA-335 Common Language Infrastructure (CLI).

Applies to