TypeBuilder.DefineInitializedData(String, Byte[], FieldAttributes) 方法

定義

在可攜式執行檔 (PE) 的 .sdata 區段中定義初始化資料欄位。Defines initialized data field in the .sdata section of the portable executable (PE) file.

public:
 System::Reflection::Emit::FieldBuilder ^ DefineInitializedData(System::String ^ name, cli::array <System::Byte> ^ data, System::Reflection::FieldAttributes attributes);
public System.Reflection.Emit.FieldBuilder DefineInitializedData (string name, byte[] data, System.Reflection.FieldAttributes attributes);
member this.DefineInitializedData : string * byte[] * System.Reflection.FieldAttributes -> System.Reflection.Emit.FieldBuilder
Public Function DefineInitializedData (name As String, data As Byte(), attributes As FieldAttributes) As FieldBuilder

參數

name
String

用來參考資料的名稱。The name used to refer to the data. name 不能包含內嵌的 null。name cannot contain embedded nulls.

data
Byte[]

資料的 blob。The blob of data.

attributes
FieldAttributes

欄位的屬性。The attributes for the field.

傳回

FieldBuilder

要參考資料的欄位。A field to reference the data.

例外狀況

name 的長度為零。Length of name is zero.

-或--or- 資料的大小小於或等於零,或者大於或等於 0x3f0000。The size of the data is less than or equal to zero, or greater than or equal to 0x3f0000.

namedatanullname or data is null.

之前已呼叫過 CreateType()CreateType() has been previously called.

備註

您使用這個方法建立的欄位將會是 static ,即使您未包含 FieldAttributes.Static 在參數中也一樣 attributesThe field that you create with this method will be static, even if you do not include FieldAttributes.Static in the attributes parameter.

適用於