Dynamic modules in a static assembly are defined using the Assembly.DefineDynamicModule method. DefineDynamicModule returns a ModuleBuilder object. These modules are always transient. The following variations of Assembly.DefineDynamicModule are provided:
Transient dynamic modules in a dynamic assembly are created using the AssemblyBuilder.DefineDynamicModule(String name) method. This method is inherited from System.Assembly.
Persistable dynamic modules in a dynamic assembly are created using the AssemblyBuilder.DefineDynamicModule methods. The dynamic assembly must have been created with the AssemblyBuilderAccess argument specified as Save or RunAndSave. DefineDynamicModule returns an AssemblyBuilder object. The following variations of AssemblyBuilder.DefineDynamicModule are provided:
The dynamic module is saved when the containing dynamic assembly is saved. To generate an executable, the ModuleBuilder.SetEntryPoint method must be called to identify the method that is the entry point to the module. If no entry point is specified, a DLL will be generated.