System.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Method

Defines a named transient dynamic module in this assembly.

Syntax

public ModuleBuilder DefineDynamicModule (string name)

Parameters

name
The name of the dynamic module. Must be less than 260 characters in length.

Returns

A System.Reflection.Emit.ModuleBuilder representing the defined dynamic module.

Remarks

It is an error to define multiple dynamic modules with the same name in an assembly.

The defined dynamic module is transient. The dynamic module is not saved, even if the parent dynamic assembly was created with AssemblyBuilderAccess.RunAndSave.

Note:

To suppress optimizations when debugging dynamic modules, apply the System.Diagnostics.DebuggableAttribute attribute to the dynamic assembly before calling erload:System.Reflection.Emit.AssemblyBuilder.DefineDynamicModule. Create an instance of System.Diagnostics.DebuggableAttribute with the System.Diagnostics.DebuggableAttribute.DebuggingModes.DisableOptimizations flag and apply it using the erload:System.Reflection.Emit.AssemblyBuilder.SetCustomAttribute method. The attribute must be applied to the dynamic assembly. It has no effect if applied to the module.

Note:

Starting with the net_v20sp1_long, this member no longer requires System.Security.Permissions.ReflectionPermission with the System.Security.Permissions.ReflectionPermissionFlag.ReflectionEmit flag. (See Security Issues in Reflection Emit.) To use this functionality, your application should target the net_v35_long or later.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0