在指定应用程序域中执行代码
点击次数:31 次 发布日期:2008-11-21 22:20:30 作者:源代码网
|
源代码网推荐源代码网整理以下
以下为引用的内容: // // 在指定应用程序域中执行代码 // // //
源代码网整理以下 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(); } } }
|
源代码网供稿. |