AppDomain.CreateInstanceFromAndUnwrap
using System;
[Serializable]
public class MyClass
{
public string HomeAppDomain
{
get
{
return AppDomain.CurrentDomain.FriendlyName;
}
}
}
public class MainClass
{
public static void Main(string[] args)
{
AppDomain newDomain = AppDomain.CreateDomain("My New AppDomain");
MyClass mbvObject = (MyClass)newDomain.CreateInstanceFromAndUnwrap(
"MainClass.exe",
"MyClass");
Console.WriteLine("AppDomain of MBV object = {0}", mbvObject.HomeAppDomain);
}
}
Related examples in the same category