The AppDomain class abstracts
application domains. An Application domain can be created using AppDomain class of System namespace, but in most cases they
are created and managed by the runtime hosts that execute the application's code.
An Application Domain is created using one of the following overloaded
CreateDomain methods of the System.AppDomain class.
Listing 1
public static AppDomain CreateDomain(String appDomainName)
public static AppDomain CreateDomain(String appDomainName, Evidence securityInformation)
public static AppDomain CreateDomain(String appDomainName,
Evidence securityInformation, AppDomainSetup appDomainSetupInformation)
public static AppDomain CreateDomain(String name,
Evidence securityInformation, String appBasePath, String appRelativeSearchPath,
bool shadowCopyFiles)
All these overloaded methods are static in nature and can be
invoked without instantiating the class. The first overloaded method accepts
the name of the Application Domain to be created and creates an Application
Domain. However, the second accepts two parameters; the first one being the
name of the Application Domain to be created while the second is a reference of
the System.Security.Policy.Evidence for specifying
the security policy for the application. The third overload accepts an
additional parameter, a reference of System.AppDomainSetup,
which is used to configure how the assemblies would be loaded into the
application. The Evidence parameter refers to a collection of the security
information on the application domain. The last overloaded CreateDomain method
accepts some additional parameters without defining a System.AppDomainSetup
object reference. The return value of each of these overloaded methods is an
AppDomain object that represents the newly created application domain.