ObjectHandle.Unwrap : ObjectHandle « System.Runtime.Remoting « C# / C Sharp by API






ObjectHandle.Unwrap

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());
  }

}

 








Related examples in the same category