MethodBuilder.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() 方法所建立。

-或- 這個方法之前是在 MethodBuilder 物件上被呼叫。

適用於