Reflection.Emit
The Reflection.Emit API provides a means to dynamically create new assemblies. Using customized builders and generating Microsoft Intermediate Language (MSIL) or Common Intermediate Language (CIL) code enables programs to create new programs at runtime. These assemblies may be dynamically invoked or saved to file where they may be reloaded and invoked or used by other programs.
Dynamic assembly creation can be useful for back-ends to compilers or scripting engines on tools such as Web browsers. Using the Reflection.Emit API, any tool can be extended to dynamically support .NET or any other Common Language Infrastructure (CLI) compliant system. Listing 28.6 shows how to both generate a dynamic assembly and save it as a console ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access