Unloading an application domain : AppDomain : Assembly C# Examples


C# Examples » Assembly » AppDomain »

 

Unloading an application domain









    
using  System;
using  System.Runtime.Remoting;
using  System.Reflection;

class  MainClass
{
    public  static  void  Main()  
    {
        AppDomain  d  =  AppDomain.CreateDomain("NewDomain");
        
        ObjectHandle  hobj  =  d.CreateInstance("AnotherDomain",  "SimpleObject");
        SimpleObject  so  =  (SimpleObject)  hobj.Unwrap();
        Console.WriteLine(so.Display("make  this  uppercase"));

        AppDomain.Unload(d);
        Console.WriteLine(so.Display("make  this  uppercase"));

    }

}


[Serializable]
public  class  SimpleObject  
{

    public  String  Display(String  inString)
    {
        return(inString.ToUpper());
    }

}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Assembly
» AppDomain