Defines a dynamic Assembly with the given name, given access, the name of the directory for saving the Assembly, supplied Evidence, and the permission requests. Optionally, the caller can specify if the creation of modules, types, and members in the dynamic Assembly should be synchronized.
Only fully trusted callers can supply their evidence when defining a dynamic Assembly. The runtime will map the Evidence through policy to determine the granted permissions. Semi-trusted callers must supply a Evidence. If evidence is a null reference (in Visual Basic Nothing), the runtime copies the permission sets, i.e., the current grant and deny sets, from the caller's Assembly to the dynamic Assembly being defined and marks policy as resolved.
If the dynamic Assembly is saved to disk, subsequent loads will get grants based on policies associated with the location where the Assembly was saved.
[Visual Basic] Overloads Public Function DefineDynamicAssembly( _ ByVal name As AssemblyName, _ ByVal access As AssemblyBuilderAccess, _ ByVal dir As String, _ ByVal evidence As Evidence, _ ByVal requiredPermissions As PermissionSet, _ ByVal optionalPermissions As PermissionSet, _ ByVal refusedPermissions As PermissionSet, _ ByVal isSynchronized As Boolean _ ) As AssemblyBuilder [C#] public AssemblyBuilder DefineDynamicAssembly( AssemblyName name, AssemblyBuilderAccess access, string dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, bool isSynchronized ); [C++] public: AssemblyBuilder* DefineDynamicAssembly( AssemblyName* name, AssemblyBuilderAccess access, String* dir, Evidence* evidence, PermissionSet* requiredPermissions, PermissionSet* optionalPermissions, PermissionSet* refusedPermissions, bool isSynchronized ); [JScript] public function DefineDynamicAssembly( name : AssemblyName, access : AssemblyBuilderAccess, dir : String, evidence : Evidence, requiredPermissions : PermissionSet, optionalPermissions : PermissionSet, refusedPermissions : PermissionSet, isSynchronized : Boolean ) : AssemblyBuilder;
An AssemblyBuilder object that represents the dynamic Assembly created.
Exception Type | Condition |
---|---|
ArgumentNullException | is thrown if name is a null reference (Nothing). |
AppDomain Class | AppDomain Members | System Namespace | AppDomain.DefineDynamicAssembly Overload List