我想实现的功能是这样的:
1、我在dll中声明了一个类如Adohelper,然后我在利用动态调用这个dll的程序中有一个方法是返回Adohelper这个类型,请关这个方法的应该如何声明。
注:不是在写程序时把dll文件引用进来,而是使用动态调用。

解决方案 »

  1.   

    string path = @"yourDllPath";      Assembly assembly = Assembly.LoadFile(path);
          
          Type type = assembly.GetType("YourNamespace.InvokeClass");
          
          object[] pars = new object[2];
          pars[0] = 0;
          pars[1] = "aaa";      Type[] parTypes = Type.GetTypeArray(pars);      object ret = type.InvokeMember("InvokeMethodName",
            BindingFlags.InvokeMethod,
            null,null,pars);