using System;
public class MyClassByRef: MarshalByRefObject
{
public string HomeAppDomain
{
get
{
return AppDomain.CurrentDomain.FriendlyName;
}
}
}
public class MainClass
{
public static void Main(string[] args)
{
AppDomain newDomain = AppDomain.CreateDomain("My New AppDomain");
MyClassByRef mbrObject =
(MyClassByRef)newDomain.CreateInstanceFromAndUnwrap(
"MainClass.exe",
"MyClassByRef");
Console.WriteLine("AppDomain of MBR object = {0}", mbrObject.HomeAppDomain);
}
}