使用反射
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpguide/html/cpcondynamicallyloadingusingtypes.htm
http://chs.gotdotnet.com/QuickStart/aspplus/default.aspx?url=%2fquickstart%2fhowto%2fdoc%2fInvoke.aspx

解决方案 »

  1.   

    添加引用,然后在需要调用的类里添加using yournamespace;
      

  2.   

    直接添加reference,using xxxnamespace不就OK了。
      

  3.   

    看你的Dll是不是托管代码?
    1.如果是托管代码写的,就直接using Dll中的类名称;直接引用那个方法就可以了。
    2.如果不是托管代码编写的,如c++或Delphi编写,就用如下方法:
      比如:
      public class ExpCalc
      {
         [DllImport("CalcExps.dll",CharSet=CharSet.Ansi)]
            public static extern int FCalcExpars((string strEpares,StringBuilder  
                                                  strErr,StringBuilder srel);
      }
      调用方法:
      int iBz;
      iBz=ExpCalc.FCalcExpars(strEpares,sbErr,sbRel); //sbErr,sbRel 都是StringBuilder类型的
      
      这个CalcExps.dll在bin目录下
      *************************