十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
public class AppDomainTest : MarshalByRefObject
{
public string TestMethodStr(string srcAppDomain)
{
string TTT = "TTT";
byte[] m_ExtraMemory = new byte[1024 * 1024 * 99];
Console.WriteLine(
"Code from the '{0}' AppDomain
" +
"called into the '{1}'. AppDomain.",
srcAppDomain, Thread.GetDomain().FriendlyName);
Console.WriteLine(
"Code from the TTT= '{0}' AppDomain
" +
"called into the '{1}'. AppDomain.",
TTT, Thread.GetDomain().FriendlyName);
return TTT;
}
}
static void Main(string[] args)AppDomain domainArcher = AppDomain.CreateDomain("MyNewDomain", null, null);
AppDomainTest test1 = (AppDomainTest)domainArcher.CreateInstanceAndUnwrap(System.Reflection.Assembly.GetCallingAssembly().FullName, "ConsoleApp1.AppDomainTest");
var tt1 = test1.TestMethodStr(Thread.GetDomain().FriendlyName);
Console.ReadLine();
}
进程内 AppDomain 间通信,但实测下,效率太慢了,只适合某些特殊情况下使用