ModuleBuilder.SetCustomAttribute 方法

定義

將自訂屬性套用至這個模組。

多載

SetCustomAttribute(CustomAttributeBuilder)

使用自訂屬性產生器,將自訂屬性套用至這個模組。

SetCustomAttribute(ConstructorInfo, Byte[])

將自訂屬性套用至這個模組,方式是使用指定的二進位大型物件 (BLOB) 表示該屬性。

SetCustomAttribute(CustomAttributeBuilder)

來源:
ModuleBuilder.cs
來源:
ModuleBuilder.cs
來源:
ModuleBuilder.cs

使用自訂屬性產生器,將自訂屬性套用至這個模組。

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)

參數

customBuilder
CustomAttributeBuilder

用來指定所要套用的自訂屬性的 Helper 類別執行個體。

例外狀況

customBuildernull

備註

注意

從 .NET Framework 2.0 Service Pack 1 開始,此成員不再需要 ReflectionPermissionReflectionPermissionFlag.ReflectionEmit標。 (請參閱反映發出中的安全性問題 ) 若要使用此功能,您的應用程式應以 .NET Framework 3.5 或更新版本為目標。

適用於

SetCustomAttribute(ConstructorInfo, Byte[])

來源:
ModuleBuilder.cs
來源:
ModuleBuilder.cs
來源:
ModuleBuilder.cs

將自訂屬性套用至這個模組,方式是使用指定的二進位大型物件 (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())

參數

con
ConstructorInfo

自訂屬性的建構函式。

binaryAttribute
Byte[]

表示屬性的位元組 BLOB。

屬性

例外狀況

conbinaryAttributenull

備註

如需如何格式化 binaryAttribute的詳細資訊,請參閱 Common Language Infrastructure (CLI) 檔,特別是「分割 II:元數據定義和語意」。 如需詳細資訊,請參閱 ECMA 335 Common Language Infrastructure (CLI)

注意

從 .NET Framework 2.0 Service Pack 1 開始,此成員不再需要 ReflectionPermissionReflectionPermissionFlag.ReflectionEmit標。 (請參閱反映發出中的安全性問題 ) 若要使用此功能,您的應用程式應以 .NET Framework 3.5 或更新版本為目標。

適用於