超級入門級:) 哈哈~ 留個紀念。
//
// 在指定應用程序域中執行代碼
//
//
//
using system;
using system.collections.generic;
using system.text;
namespace domaintest
{
class program
{
private static string strkey = "key1";
static void main(string[] args)
{
appdomain domaintest = appdomain.createdomain("domaintest");
string strval = "value1";
domaintest.setdata(strkey, strval);
// 跨程序域調用委托
crossappdomaindelegate callback = delegate
{
// 取得當前程序域
appdomain domain = appdomain.currentdomain;
console.writeline(string.format("value: {0} in {1}", domain.getdata(strkey), domain.friendlyname));
};
// 在指定程序域中執行代碼
domaintest.docallback(callback);
console.read();
}
}
}
新聞熱點
疑難解答