超级入门级:) 哈哈~ 留个纪念。
//
// 在指定应用程序域中执行代码
//
//
//


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();
        }
    }
}

相关文章:

  • 2022-12-23
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2021-11-18
猜你喜欢
  • 2022-01-07
  • 2021-07-13
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2021-08-06
相关资源
相似解决方案