AppDomain.DomainUnload : AppDomain « System « C# / C Sharp by API






AppDomain.DomainUnload

  

using System;
using System.Reflection;
using System.Windows.Forms;
  
public class MainClass
{
  public static void defaultAD_DomainUnload(object sender, EventArgs e)
  {
    Console.WriteLine("Unloaded defaultAD!");
  }
  private static void defaultAD_ProcessExit(object sender, EventArgs e)
  {
    Console.WriteLine("Unloaded defaultAD!");
  }

  public static int Main(string[] args)
  {
    AppDomain defaultAD = AppDomain.CreateDomain("SecondAppDomain");

    defaultAD.DomainUnload += new EventHandler(defaultAD_DomainUnload);
    defaultAD.ProcessExit +=new EventHandler(defaultAD_ProcessExit);

    // Now unload anotherAD.
    AppDomain.Unload(defaultAD);

    return 0;
  }
}

   
    
  








Related examples in the same category

1.AppDomain.CreateDomain
2.AppDomain.CreateInstance
3.AppDomain.CreateInstanceAndUnwrap
4.AppDomain.CreateInstanceFromAndUnwrap
5.AppDomain.CurrentDomain.FriendlyName
6.AppDomain.CurrentDomain
7.AppDomain.DefineDynamicAssembly
8.AppDomain.DoCallBack
9.AppDomain.FriendlyName
10.AppDomain.GetAssemblies
11.AppDomain.GetData
12.AppDomain.OnUnhandledException
13.AppDomain.ProcessExit
14.AppDomain.SetData
15.AppDomain.SetPrincipalPolicy
16.AppDomain.Unload