注销

注销

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  112 随笔 :: 7 文章 :: 18 评论 :: 0 Trackbacks
string DllPath = Application.StartupPath + @"\someDLL.dll";
System.Reflection.Assembly assmble = System.Reflection.Assembly.LoadFile(DllPath);
Type tmpType = assmble.GetType("someDLL.ClassA");
System.Reflection.MethodInfo tmpM = tmpType.GetMethod("Add");
object tmpobj = assmble.CreateInstance("someDLL.ClassA");
int i = (int)tmpM.Invoke(tmpobj, new object[]{2,3});

----------ClassA的定义--------------------
using System;

namespace someDLL
{
/// <summary>
/// ClassA 的摘要说明。
/// </summary>
public class ClassA
{
public ClassA()
{
//
// TODO: 在此处添加构造函数逻辑
//
}

public int Add(int a, int b)
{
return a+b;
}
}
}
posted on 2006-11-28 15:48 注销..... 阅读(605) 评论(1)  编辑  收藏 所属分类: .net摘要

评论

# re: 动态加载DLL 2011-09-03 17:22
没看懂  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: