All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
在指定应用程序域中执行代码_[Asp.Net教程]

Writer: delv Article type: Programming skills(编程技巧) Time: 2014/1/6 9:11:43 Browse times: 300 Comment times: 0

在指定应用程序域中执行代码_[Asp.Net教程]


Head photo

Go homepage
Upload pictures
Write articles

在指定应用程序域中执行代码_[Asp.Net教程]

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


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

来源:网络





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.