Assembly.Load(String) method takes a long form of the assembly nametryAssembly aBox = Assembly.LoadFrom(aBoxFile.FullName); Type t = aBox.GetType("Web_Sn_Extend_Library.Extend_Library");
here is the code I used on my machine(.NET 1.1):Assembly aBox = Assembly.LoadFrom(aBoxFile.FullName); Type t = aBox.GetType("Web_Sn_Extend_Library.Extend_Library"); Response.Write("***" + (t!=null)); MethodInfo m = t.GetMethod("method1",BindingFlags.Public | BindingFlags.Instance); object o = Activator.CreateInstance(t); string i =(string) m.Invoke(o,null); System.Web.HttpContext.Current.Response.Write(" SSS动态调用DLL 里的值: " + i);
saucer(思归) 动态调用DLL 里的值: I am Static method (method1) in class1终于取出来了。。5~~~~~~~~~谢谢阿
>>>>如果方法有返回值的怎么处理呢?????string i =(string) m.Invoke(o,null);
Type t = aBox.GetType("Web_Sn_Extend_Library.Extend_Library");
Type t = aBox.GetType("Web_Sn_Extend_Library.Extend_Library");
Response.Write("***" + (t!=null));
MethodInfo m = t.GetMethod("method1",BindingFlags.Public | BindingFlags.Instance);
object o = Activator.CreateInstance(t);
string i =(string) m.Invoke(o,null);
System.Web.HttpContext.Current.Response.Write(" SSS动态调用DLL 里的值: " + i);
动态调用DLL 里的值: I am Static method (method1) in class1终于取出来了。。5~~~~~~~~~谢谢阿