|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Defining a Dynamic Module
This topic identifies methods for creating a dynamic module.
Transient dynamic modules in a dynamic assembly are created using the DefineDynamicModule method.
Persistable dynamic modules in a dynamic assembly are created using the AssemblyBuilder.DefineDynamicModule methods. The dynamic assembly must be created with the AssemblyBuilderAccess argument specified as Save or RunAndSave. DefineDynamicModule returns an AssemblyBuilder.
The following variations of AssemblyBuilder.DefineDynamicModule are provided:
Define a persistable dynamic module with the given name and the given file name.
Define a persistable dynamic module with the given name and the given file name, and conditionally emit symbolic information using the default implementation of the symbol writer interface.
The dynamic module is saved when the containing dynamic assembly is saved. By default, reflection emit generates DLLs. To generate a console application or a Windows-based application, the AssemblyBuilder.SetEntryPoint method must be called.