日期:2014-05-17 浏览次数:20912 次
using System;
namespace GsApprovalDllSpace
{
public class GsApprovalDll
{
public bool submit(string[] strValue)
{
return true;
}
}
}
try
{
string dllPath = Application.StartupPath+"\\xxx.dll";
//声明一个反射类对象
System.Reflection.Assembly a = System.Reflection.Assembly.LoadFile(dllPath);
//定义一个"类型信息"的对象.
Type t = a.GetType("GsApprovalDllSpace.GsApprovalDll");
//定义一个成员信息类对象数组,并从程序集中获取.
MethodInfo method1 = t.GetMethod("submit");
object obj = a.CreateInstance("GsApprovalDllSpace.GsApprovalDll");
string[] parts = new string[2];
parts[0] = "bbb";
parts[1] = "aaa";
bool b = (bool)method1.Invoke(obj, new objec