求教。。我是菜鸟啊

解决方案 »

  1.   

    use System.Reflection.Assembly class, load it, then call its CreateInstance or Activator.CreateInstance, see the example in the documentation:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemreflectionassemblyclasstopic.asp
      

  2.   

    动态加入的dll中的类??比如你这个dll的命名空间为webmanage,类名称也是webmanage
    将你的dll在vs中添加引用,在程序的.cs文件中:using webmanage;
    使用时:webmanage wm = new webmanage();
            wm.方法();
      

  3.   

    谢谢一楼的,不过我还是不大明白,好比dll命名空间为test,类也为test,类中有一个函数叫t(),请问我该如何去动态饮用,然后调用函数t.
      

  4.   


    didn't try, but something like thisusing System;
    using System.Reflection; Assembly a = Assembly.LoadFrom("yourassemblyname");
     Type t = a.GetType("test.test",true,true);
     
     MethodInfo mi = t.GetMethod("t",BindingFlags.NonPublic | BindingFlags.Public | 
                BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
     Object obj = Activator.CreateInstance(t);
     m.Invoke(obj, null);
    by the way, it is a bad style to name a class as 'test' under namespace 'test'
      

  5.   

    System.Reflection.Assembly.Load 或 System.Reflection.Assembly.LoadFrom,创建饮用dll的Assembly。然后,使用此Assembly的CreateInstance方法或者GetType(...).Getconstructor(...).Invoke(...)方法创建实例。