This documentation is archived and is not being maintained.

DynamicILInfo Class

Note: This class is new in the .NET Framework version 2.0.

Provides support for alternative ways to generate the Microsoft intermediate language (MSIL) and metadata for a dynamic method, including methods for creating tokens and for inserting the code, exception handling, and local variable signature blobs.

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

public class DynamicILInfo
/** @attribute ComVisibleAttribute(true) */ 
public class DynamicILInfo
public class DynamicILInfo

The DynamicILInfo class allows developers to write their own MSIL generators instead of using ILGenerator.

To create instances of other types, call methods, and so on, the MSIL you generate must include tokens for those entities. The DynamicILInfo class provides several overloads of the GetTokenFor method, which return tokens valid in the scope of the current DynamicILInfo. For example, if you need to call an overload of the System.Console.WriteLine method, you can obtain a RuntimeMethodHandle for that overload and pass it to the GetTokenFor method to obtain a token to embed in your MSIL.

Once you have created Byte arrays for your local variable signature, exceptions, and code body, you can use the SetCode, SetExceptions, and SetLocalSignature methods to insert them into the DynamicMethod associated with your DynamicILInfo object.

Generating your own metadata and MSIL requires familiarity with the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics" and "Partition III: CIL Instruction Set". The documentation is available online at and


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0