在指定應用程序域中執行代碼_.Net教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      推薦:C#中的委托和事件
      引言 委托和事件在 .Net Framework中的應用非常廣泛,然而,較好地理解委托和事件對很多接觸C#時間不長的人來說并不容易。它們就像是一道檻兒,過了這個檻的人,覺得真是太容易了,而沒有過去


      以下為引用的內容:
      //
      // 在指定應用程序域中執行代碼
      //
      //
      //


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

      分享:ASP.NET中“找不到指定模塊”的解決辦法
      最近繼續用ASP.Net來重新開發ACM的Online Judge系統,因為要進行進程的監控,所以自己編寫了一個非托管的DLL供ASP.Net調用。 我用的是VS2005的開發環境,后來發現使用[DllImport("Judge.

      來源:模板無憂//所屬分類:.Net教程/更新時間:2008-08-22
      相關.Net教程