AppDomain Class
Represents an application domain, which is an isolated environment where applications execute. This class cannot be inherited.
For a list of all members of this type, see AppDomain Members.
System.Object
System.MarshalByRefObject
System.AppDomain
[Visual Basic] <ClassInterface(ClassInterfaceType.None)> NotInheritable Public Class AppDomain Inherits MarshalByRefObject Implements _AppDomain, IEvidenceFactory [C#] [ClassInterface(ClassInterfaceType.None)] public sealed class AppDomain : MarshalByRefObject, _AppDomain, IEvidenceFactory [C++] [ClassInterface(ClassInterfaceType::None)] public __gc __sealed class AppDomain : public MarshalByRefObject, _AppDomain, IEvidenceFactory [JScript] public ClassInterface(ClassInterfaceType.None) class AppDomain extends MarshalByRefObject implements _AppDomain, IEvidenceFactory
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
Application domains, which are represented by AppDomain objects, help 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 (Assembly). When an AppDomain is no longer in use, it can be unloaded.
The AppDomain class implements a set of events that enable applications to respond when an assembly is loaded, when an application domain will be unloaded, or when an unhandled exception is thrown.
For more information on using application domains, see Application Domains or the list of Frequently Asked Questions at www.gotdotnet.com.
This class implements the MarshalByRefObject, _AppDomain, and IEvidenceFactory interfaces.
You should never create a remotable wrapper for an AppDomain object. If you do, you could inadvertently publish a reference to that AppDomain remotely, which would expose that AppDomain's CreateInstance method (and others) remotely and effectively destroy any code access security for that AppDomain. Malicious clients connecting to the remoted AppDomain could obtain access to any resource to which the AppDomain itself has access. You should not create remotable wrappers for any type that extends MarshalByRefObject and that implements methods that could be used by malicious clients to bypass the security system.
CAUTION The default value for the System.AppdomainSetup.DisalowCodeDownload property is false. This setting is unsafe for services. To prevent services from downloading partially trusted code, set this property to true.
.NET Compact Framework Platform Note: The .NET Compact Framework does not support loading assemblies into a domain neutral code area for use by multiple application domains.
Requirements
Namespace: System
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: Mscorlib (in Mscorlib.dll)