网站建设费用能否计入广告费,微信 微网站开发,大连 网站制作,如何开发高端市场使用反射的方式调用组件里面的方法#xff0c;经常会遇见一些象地址参数的处理#xff0c;在C#中表现为ref参数#xff0c;比如用C#写了一个装配件#xff0c;里面有一个方法openProcedure(string ProcName,int paraCount,ref string[] parameters)#xff0c;最后有一个r…使用反射的方式调用组件里面的方法经常会遇见一些象地址参数的处理在C#中表现为ref参数比如用C#写了一个装配件里面有一个方法openProcedure(string ProcName,int paraCount,ref string[] parameters)最后有一个ref参数反射调用代码写法如下
try { DataSet dsnew DataSet (); Type objType; object objBinding; objType Type.GetTypeFromProgID(CSGPDBAccess.CSGPDBAccess); objBinding Activator.CreateInstance(objType); Type[] paramTypes new Type[] {Type.GetType(System.String), Type.GetType(System.Int32), Type.GetType(System.String[])}; MethodInfo m objType.GetMethod(openProcedure,paramTypes); object[] args new object[3]; args[0] Test; args[1] 1; args[2] new string[]{0052005}; ds(DataSet)m.Invoke(objBinding,args); if(ds.Tables.Count0 ) { dataGrid1.DataSourceds.Tables[0].DefaultView ; } } catch(TargetInvocationException ee) { MessageBox.Show(ee.Message); }