Generating Code at Runtime with Reflection.Emit
System.Reflection.Emit namespace provides objects for generating assemblies, types, and type members at runtime. You need to perform the following operations sequentially:
1. Create an in-memory assembly within the current application domain with an instance of the
2. Create a module for containing types via an instance of the
3. Create types with instances of the
4. Add members to the
XBuilder objects, such as
5. Save the assembly to disk if required.
The code in Listing 44.4 demonstrates how to dynamically create a simple implementation of the
Person class with ...