|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 |
//需要反射的类string
refClass = info.ChargeClass;//当前类所在的dllstring
path = Environment.CurrentDirectory + "\\ActionManager.dll";//加载dllAssembly 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; |
原文:http://www.cnblogs.com/chenmenghappy/p/3539510.html