分类广告


推荐文章

  • 没有找到任何内容!
您当前的位置:中国站长下载网络编程NET专区 → 文章内容

在指定应用程序域中执行代码

  • 作者:不详    来源:网络转载    发布时间:2008-2-28 8:32:05
  • 字体大小:


以下为引用的内容:
//
// 在指定应用程序域中执行代码
//
//
//


using System;
using System.Collections.Generic;
using System.Text; Chinaz

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); Www^

            Console.Read();
        }
    }
}
Chinaz_com

站.长站