See Also: AppDomain Members
Application domains, which are represented by AppDomain objects, provide isolation, unloading, and security boundaries for executing managed code.
Multiple application domains can run in a single process; however, there is not a one-to-one correlation between application domains and threads. Several threads can belong to a single application domain, and while a given thread is not confined to a single application domain, at any given time, a thread executes in a single application domain.
Application domains are created using the CreateDomain method. AppDomain instances are used to load and execute assemblies (System.Reflection.Assembly). When a AppDomain is no longer in use, it can be unloaded.
The AppDomain class implements a set of events to enable applications to respond to the following conditions:
| Condition | Event |
|---|---|
| An assembly was loaded. | AppDomain.AssemblyLoad |
| An application domain will be unloaded. | AppDomain.DomainUnload |
| An unhandled exception was thrown. | AppDomain.UnhandledException |