Emitting Dynamic Methods and Assemblies
This section describes a set of managed types in the System.Reflection.Emit namespace that enable your application to emit metadata and Microsoft intermediate language (MSIL) at run time. Script engines and compilers are the primary users of this namespace. In this section, the functionality provided by the System.Reflection.Emit namespace is referred to as reflection emit.
Reflection emit provides the following capabilities:
-
Defines lightweight global methods at run time, using the DynamicMethod class, and executes them using delegates.
-
Generates assemblies at run time.
-
Defines types in modules at run time, creates instances of these types, and invokes their methods.
A useful resource for working with metadata and MSIL is 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 the ECMA C# and Common Language Infrastructure Standards page on MSDN and on the Ecma International Web site.