共用方式為


Defining a Dynamic Module 

This topic identifies methods for creating a dynamic module.

Defining a Transient Dynamic Module in a Dynamic Assembly

Transient dynamic modules in a dynamic assembly are created using the AssemblyBuilder.DefineDynamicModule(String) method.

Defining a Persistable Dynamic Module in a Dynamic Assembly

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.

See Also

Other Resources

Using Reflection Emit