Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Application domains are usually created and manipulated programmatically by runtime hosts. However, sometimes an application program might also want to work with application domains. For example, an application program could load an application component into a ___domain to be able to unload the ___domain (and the component) without having to stop the entire application.
The AppDomain class is the programmatic interface to application domains. This class includes methods to create and unload domains, to create instances of types in domains, and to register for various notifications such as application ___domain unloading. The following table lists commonly used AppDomain methods.
AppDomain Method |
Description |
---|---|
Creates a new application ___domain. It is recommended that you use an overload of this method that specifies an AppDomainSetup object. This is the preferred way to set the properties of a new ___domain, such as the application base, or root directory for the application; the ___location of the configuration file for the ___domain; and the search path that the common language runtime is to use to load assemblies into the ___domain. |
|
Executes an assembly in the application ___domain. This is an instance method, so it can be used to execute code in another application ___domain to which you have a reference. |
|
Creates an instance of a specified type in the application ___domain, and returns a proxy. Use this method to avoid loading the assembly containing the created type into the calling assembly. |
|
Performs a graceful shutdown of the ___domain. The application ___domain is not unloaded until all threads running in the ___domain have either stopped or are no longer in the ___domain. |
Note
The common language runtime does not support serialization of global methods, so delegates cannot be used to execute global methods in other application domains.
The unmanaged interfaces described in the common language runtime Hosting Interfaces Specification also provide access to application domains. Runtime hosts can use interfaces from unmanaged code to create and gain access to the application domains within a process.