您的位置:首页 > 编程语言 > C#

C#可以实现DLL库的动态调用

2006-02-14 08:44 225 查看
Assembly assmebly = Assembly.LoadFile(@"C:WindowsApplication2005-09-30.dll");
Type t = assmebly.GetType("WindowsApplication2005_09_30.Class1");
object obj = Activator.CreateInstance(t,null);
MethodInfo method = t.GetMethod("Test01");
int i = (int)method.Invoke(obj,new object[1]{10});
namespace WindowsApplication2005_09_30
{
public class Class1
{
public int Test01(int i)
{
return i*10;
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: