动态调用类库
--------------------编程问答-------------------- Assembly.CreateInstance(a); --------------------编程问答-------------------- 动态引用 dll 需要用到 using System.Reflection; 这个反射命名空间。private void test()
{
Assembly ass = Assembly.Load("dll"); //加载dll文件
Type tp = ass.GetType("dll.Meta"); //获取类名,必须 命名空间+类名
Object obj = Activator.CreateInstance(tp); //建立实例
MethodInfo meth = tp.GetMethod("Numerics"); //获取方法
int t = Convert.ToInt32( meth.Invoke(obj, new Object[]{2, 3}) ); //Invoke调用方法
MessageBox.Show(t.ToString());
}
--------------------编程问答-------------------- 学习了
补充:.NET技术 , C#