1. References
1 " HQBuy.MVC.BLL.Member.ORD.ORD_PurchaseBLL " " Getpurchasebypno ");
2. Methods
PublicIresult executedmsparam<t1, t2> (T1 t1, T2 T2,stringClassName,stringMethodName) {Type type=t1. GetType (); if(Type. GetProperties ()! =NULL&& type. GetProperties (). Length >0) { foreach(varPropertieinchtype. GetProperties ()) {if(!string. IsNullOrEmpty (Propertie. Name)) {Switch(Propertie. Name) { Case "AssemblyName": T1. GetType (). GetProperty (Propertie. Name). SetValue (T1,"HQBuy.MVC.BLL.Member.dll"); Break; Case "ClassName": T1. GetType (). GetProperty (Propertie. Name). SetValue (t1, ClassName); Break; Case "MethodName": T1. GetType (). GetProperty (Propertie. Name). SetValue (t1, MethodName); Break; Case "Param": T1. GetType (). GetProperty (Propertie. Name). SetValue (t1, T2); Break; } }}} Iresult result=Executebll.execute ((iparam) t1); if(Result.complete = =dmscomplete.succeed) {Conditionresult<ORD_Purchase> purchasecondition =NewConditionresult<ord_purchase>(); if(result.) Result! =NULL) {purchasecondition= (conditionresult<ord_purchase>) result. Result; List<ORD_Purchase> purchaselist =(purchasecondition). Resultlist; } } returnresult; }
C # Learning (9): Setting properties and values of generic types by reflection