1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
//需要反射的类 string
refClass = info.ChargeClass;
//当前类所在的dll string
path = Environment.CurrentDirectory + "\\ActionManager.dll" ;
//加载dll Assembly t = Assembly.LoadFile(path); //创建类的实例 object
obj = t.CreateInstance(refClass);
Type type = obj.GetType(); ChargePhoneInfo chargePhoneInfo = ChannelChangeMng.ChargePhoneInfoParse(info); CookieContainer cookie = new
CookieContainer();
string
errMsg = string .Empty;
//发射类中方法调用所需传递的参数 object [] args = new
object [] { chargePhoneInfo, cookie, errMsg };
//SyncOrder 指的是需要调用反射类中的SyncOrder方法 object
objReturn = type.InvokeMember( "SyncOrder" , BindingFlags.InvokeMethod, null , obj, args);
ChargeResult cr = (ChargeResult)objReturn; return
cr;
|