Export (0) Print
Expand All

ConstructorBuilder.SetMethodBody Method

.NET Framework 4.5

Creates the body of the constructor by using a specified byte array of Microsoft intermediate language (MSIL) instructions.

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public void SetMethodBody(
	byte[] il,
	int maxStack,
	byte[] localSignature,
	IEnumerable<ExceptionHandler> exceptionHandlers,
	IEnumerable<int> tokenFixups


Type: System.Byte[]

An array that contains valid MSIL instructions.

Type: System.Int32

The maximum stack evaluation depth.

Type: System.Byte[]

An array of bytes that contain the serialized local variable structure. Specify null if the constructor has no local variables.

Type: System.Collections.Generic.IEnumerable<ExceptionHandler>

A collection that contains the exception handlers for the constructor. Specify null if the constructor has no exception handlers.

Type: System.Collections.Generic.IEnumerable<Int32>

A collection of values that represent offsets in il, each of which specifies the beginning of a token that may be modified. Specify null if the constructor has no tokens that have to be modified.


il is null.


maxStack is negative.


One of exceptionHandlers specifies an offset outside of il.


One of tokenFixups specifies an offset that is outside the il array.


The containing type was previously created using the TypeBuilder.CreateType method.


This method was called previously on this ConstructorBuilder object.

.NET Framework

Supported in: 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft