在指定应用程序域中执行代码
减小字体
增大字体
作者:515down(收集) 来源:515down(网络) 发布时间:2008-1-8 15:49:24
以下为引用的内容: // // 在指定应用程序域中执行代码 // // // 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)); }; Www^515down^com
// 在指定程序域中执行代码 domaintest.DoCallBack(callback); 515down_com
Console.Read(); } } }
我要我当软件园
|
515down.com