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 对象上调用。

适用于