ConstructorBuilder.SetMethodBody 方法

定義

透過使用指定的 Microsoft 中介語言(MSIL)指令的位元組陣列來建立建構子的主體。

public:
 void SetMethodBody(cli::array <System::Byte> ^ il, int maxStack, cli::array <System::Byte> ^ localSignature, System::Collections::Generic::IEnumerable<System::Reflection::Emit::ExceptionHandler> ^ exceptionHandlers, System::Collections::Generic::IEnumerable<int> ^ tokenFixups);
public void SetMethodBody(byte[] il, int maxStack, byte[] localSignature, System.Collections.Generic.IEnumerable<System.Reflection.Emit.ExceptionHandler> exceptionHandlers, System.Collections.Generic.IEnumerable<int> tokenFixups);
member this.SetMethodBody : byte[] * int * byte[] * seq<System.Reflection.Emit.ExceptionHandler> * seq<int> -> unit
Public Sub SetMethodBody (il As Byte(), maxStack As Integer, localSignature As Byte(), exceptionHandlers As IEnumerable(Of ExceptionHandler), tokenFixups As IEnumerable(Of Integer))

參數

il
Byte[]

一個包含有效 MSIL 指令的陣列。

maxStack
Int32

最大堆疊評估深度。

localSignature
Byte[]

一個包含序列化局部變數結構的位元組陣列。 指定 null 建構子是否沒有區域變數。

exceptionHandlers
IEnumerable<ExceptionHandler>

一個包含建構子例外處理程序的集合。 請指定 null 建構子是否沒有例外處理程序。

tokenFixups
IEnumerable<Int32>

一組代表 中 il偏移量的值,每個值指定可修改的符號的起始點。 指定 null 建構子是否沒有需要修改的標記。

例外狀況

ilnull

maxStack 為負數。

-或-

其中之一exceptionHandlers指定了偏移量。il

-或-

其中一個 tokenFixups 指定了一個偏移量,該偏移量位於陣列之外 il

包含型先前就是用該 CreateType() 方法建立的。

-或-

此方法先前 ConstructorBuilder 在此物件中被呼叫過。

適用於