|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Unloading Domains and Shutting Down a Process
Application domains can be unloaded without stopping the entire process. Hosts can take advantage of this feature to unload code that is no longer needed, thereby reducing memory use and increasing the scalability of their application.
The System.AppDomain class includes a static method called that hosts can use to unload a particular application domain. AppDomain.Unload performs a graceful shutdown, not unloading the application domain until there are no more active threads.
Assemblies that have been loaded into the default application domain or assemblies that have been loaded as application domain-neutral cannot be unloaded without shutting down the entire process.
Themethod can be used to disable the common language runtime in a process. After has been called on a process, the runtime cannot be restarted in that process. must be called once for each time has been called.
Theinterface is new in the .NET Framework version 2.0. In versions 1.0 and 1.1, use the method to disable the runtime.