System.AppDomain.DefineDynamicAssembly Method

Defines a dynamic assembly with the specified name and access mode.

Syntax

public System.Reflection.Emit.AssemblyBuilder DefineDynamicAssembly (System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access)

Parameters

name
The unique identity of the dynamic assembly.
access
The access mode for the dynamic assembly.

Returns

A dynamic assembly with the specified name and access mode.

Remarks

This method should only be used to define a dynamic assembly in the current application domain. For more information, see the AppDomain.Load(System.Reflection.AssemblyName) method overload.

Note:

During the development of code that emits dynamic assemblies, it is recommended that you use an overload of the erload:System.AppDomain.DefineDynamicAssembly method that specifies evidence and permissions, supply the evidence you want the dynamic assembly to have, and include System.Security.Permissions.SecurityPermissionFlag.SkipVerification in refusedPermissions. Including System.Security.Permissions.SecurityPermissionFlag.SkipVerification in the refusedPermissions parameter ensures that the MSIL is verified. A limitation of this technique is that it also causes System.Security.SecurityException to be thrown when used with code that demands full trust.

Requirements

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