反射调用外部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 );

你可能感兴趣的:(dll)