留下点什么为好

总是觉得不管干什么,留下点什么为好。
随笔 - 55, 文章 - 2, 评论 - 94, 引用 - 0
数据加载中……

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

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


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

posted on 2006-06-26 09:53 萝卜青菜 阅读(271) 评论(0)  编辑 收藏 所属分类: WinForm


标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2006-06-26 09:55 编辑过


相关链接: