// This call is simply to load additional
// assemblies into this app domain.
MessageBox.Show("Hello");
PrintAllAssembliesInAppDomain(defaultAD);
Console.ReadLine();
}
Figure 17-6 shows the output.
Figure 17-6.
Enumerating assemblies within the current application domain
Programmatically Creating New AppDomains
Recall that a single process is capable of hosting multiple AppDomains. While it is true that you will
seldom (if ever) need to manually create AppDomains in code, you are able to do so via the static
CreateDomain() method. As you would guess, AppDomain.CreateDomain() has been overloaded a
number of times. At minimum, you will specify the friendly name of the new application domain,
as shown here:
static void Main(string[] args)
{
...
Do'stlaringiz bilan baham: