反射调用外部exe/dll

代码
var filename = Server.MapPath(@"data/a.exe");
Assembly asm
= System.Reflection.Assembly.LoadFile(filename);
Type type
= asm.GetType("aaaa");
Object oper
= Activator.CreateInstance(type);

object[] paras = new object[] { 'a','b'};
MethodInfo method
= t.GetMethod("CreateSMS");
BindingFlags flag
= BindingFlags.Public | BindingFlags.Instance;

object result = method.Invoke(oper, flag, Type.DefaultBinder, paras, null);
posted @ 2010-12-22 11:41  webaspx  阅读(361)  评论(0编辑  收藏  举报