注銷

          注銷

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            112 隨筆 :: 7 文章 :: 18 評論 :: 0 Trackbacks
          string DllPath = Application.StartupPath + @"\someDLL.dll";
          System.Reflection.Assembly assmble = System.Reflection.Assembly.LoadFile(DllPath);
          Type tmpType = assmble.GetType("someDLL.ClassA");
          System.Reflection.MethodInfo tmpM = tmpType.GetMethod("Add");
          object tmpobj = assmble.CreateInstance("someDLL.ClassA");
          int i = (int)tmpM.Invoke(tmpobj, new object[]{2,3});

          ----------ClassA的定義--------------------
          using System;

          namespace someDLL
          {
          /// <summary>
          /// ClassA 的摘要說明。
          /// </summary>
          public class ClassA
          {
          public ClassA()
          {
          //
          // TODO: 在此處添加構造函數邏輯
          //
          }

          public int Add(int a, int b)
          {
          return a+b;
          }
          }
          }
          posted on 2006-11-28 15:48 注銷..... 閱讀(629) 評論(1)  編輯  收藏 所屬分類: .net摘要

          評論

          # re: 動態加載DLL 2011-09-03 17:22
          沒看懂  回復  更多評論
            

          主站蜘蛛池模板: 墨竹工卡县| 亚东县| 监利县| 都匀市| 孟州市| 黄冈市| 乐亭县| 荔浦县| 张家川| 阳东县| 嘉义市| 扎鲁特旗| 菏泽市| 南川市| 德兴市| 噶尔县| 达孜县| 吴忠市| 务川| 南川市| 丹江口市| 遂昌县| 霍邱县| 扶沟县| 松原市| 永宁县| 资兴市| 五家渠市| 邯郸市| 吴川市| 瑞昌市| 鞍山市| 绥阳县| 全南县| 富川| 临安市| 罗定市| 永宁县| 河北区| 河南省| 尉氏县|