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