Share via


ConstructorBuilder.GetILGenerator Method (Int32)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns a Microsoft intermediate language (MSIL) generator, with the specified MSIL stream size, that can be used to build a method body for this constructor.

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

Syntax

'Declaration
Public Function GetILGenerator ( _
    streamSize As Integer _
) As ILGenerator
public ILGenerator GetILGenerator(
    int streamSize
)

Parameters

  • streamSize
    Type: System.Int32
    The size of the MSIL stream, in bytes.

Return Value

Type: System.Reflection.Emit.ILGenerator
An MSIL generator that can be used to emit a method body for this constructor.

Exceptions

Exception Condition
InvalidOperationException

The constructor is a default constructor that was created by using the TypeBuilder.DefineDefaultConstructor method.

-or-

The constructor has MethodAttributes or MethodImplAttributes flags indicating that it should not have a method body.

Remarks

The runtime generates the code for default (parameterless) constructors that are created by using the TypeBuilder.DefineDefaultConstructor method. An exception is thrown if you try to obtain an ILGenerator for such a constructor.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.