留下点什么为好

总是觉得不管干什么,留下点什么为好。
随笔 - 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 萝卜青菜 阅读(294) 评论(0)  编辑 收藏 网摘 所属分类: WinForm


发表评论



姓名 [登录] [注册] 
主页
Email (仅博主可见) 
验证码 *  验证码看不清,换一张
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论   新用户注册   返回页首      

导航: 网站首页 社区 新闻 博问 闪存 网摘 招聘 .NET频道 知识库 找找看 Google站内搜索



China-pub 计算机图书网上专卖店!6.5万品种 2-8折!
China-Pub 计算机绝版图书按需印刷服务

相关文章:

相关链接: