c# 对COM+对象反射调用时地址参数处理 c# 对COM+对象反射调用时地址参数处理

使用反射的方式调用组件里面的方法,经常会遇见一些象地址参数的处理,在C#中表现为ref参数,比如用C#写了一个装配件,里面有一个方法openProcedure(string ProcName,int paraCount,ref string[] parameters),最后有一个ref参数,反射调用代码写法如下:

try
   {
    DataSet ds=new 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.Count>0 )
    {
     dataGrid1.DataSource=ds.Tables[0].DefaultView ;
    }
   }
   catch(TargetInvocationException ee)
   {
    MessageBox.Show(ee.Message);
   }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/389169.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

android触摸消息的派发过程

1.触摸消息是消息获取模块直接派发给应用程序的。 2.触摸消息在处理时, 需要根据触摸坐标计算该消息应该派发给哪个View/ViewGroup, 在案件取消处理中不存在 该计算过程。 3.没有类似”系统按键”的”系统触摸键”, 应用程序可完全控制触摸行为。 4.子…

python 交互式流程图_使用Python创建漂亮的交互式和弦图

python 交互式流程图Python中的数据可视化 (Data Visualization in Python) R vs Python is a constant tussle when it comes to what is the best language, according to data scientists. Though each language has it’s strengths, R, in my opinion has one cutting-edg…

机器学习解决什么问题_机器学习帮助解决水危机

机器学习解决什么问题According to Water.org and Lifewater International, out of 57 million people in Tanzania, 25 million do not have access to safe water. Women and children must travel each day multiple times to gather water when the safety of that water …

递归原来可以so easy|-连载(3)

本期我们再通过几个例子,加深递归的理解和熟练度。 上期有一个练习题:用递归逆序输出一个包含整型数据的链表。 先完成这个练习题。 对于程序员来说,代码是最好的沟通工具,什么都不说,上代码: public class…

Viewport3D 类Viewport3D 类Viewport3D 类

.NET Framework 类库Viewport3D 类更新:2007 年 11 月为三维可视内容提供呈现图面。命名空间: System.Windows.Controls程序集: PresentationFramework(在 PresentationFramework.dll 中)用于 XAML 的 XMLNS&#xf…

升级android 6.0系统

How to Fix errors by manually flashing Marshmallow update 镜像下载for nexus Factory image Step 1: Download the [Marshmallow factory image](http://www.theandroidsoul.com/download-mra58k-android-6-0-marshmallow-update-released-for-nexus-5-nexus-6-nexus-9-n…

AGC 022 B - GCD Sequence

题面在这里&#xff01; 锻炼脑子的小构造题。。。 一开始被 a[]<30000 且 序列 gcd 1所困扰&#xff0c;但是发现这并没有什么&#xff0c;因为我接下来发现了一种总是能构造出 序列和是6的倍数的方案。 首先如果 n3 的话输出样例&#xff0c;因为只有这种情况没法用我的方…

最接近原点的 k 个点_第K个最接近原点的位置

最接近原点的 k 个点In this article, I will be explaining to you one of the problems that you may find when tackling questions in data structures and algorithm. You will need some basic knowledge of data structures in order to understand the optimized solut…

网络浏览器如何工作

Behind the scenes of modern Web Browsers现代Web浏览器的幕后花絮 The Web Browser is inarguably the most common portal for users to access the web. The advancement of the web browsers (through the series of history) has led many traditional “thick clients”…

让自己的头脑极度开放

为什么80%的码农都做不了架构师&#xff1f;>>> 一. 头脑封闭和头脑开放 头脑封闭 你是否经常有这样的经历&#xff0c;在一次会议或者在一次小组讨论时&#xff0c;当你提出一个观点而被别人否定时&#xff0c;你非常急迫地去反驳别人&#xff0c;从而捍卫自己的尊…

简介DOTNET 编译原理 简介DOTNET 编译原理 简介DOTNET 编译原理

简介DOTNET 编译原理 相信大家都使用过 Dotnet &#xff0c;可能还有不少高手。不过我还要讲讲Dotnet的基础知识&#xff0c;Dotnet的编译原理。 Dotnet是一种建立在虚拟机上执行的语言&#xff0c;它直接生成 MSIL 的中间语言&#xff0c;再由DotNet编译器 JIT 解释映象为本机…

RecyclerView详细了解

关于RecyclerView大家都不陌生了&#xff0c;它的使用也越来越受欢迎&#xff0c;现在总体了解一下RecyclerView的作用&#xff0c;为什么会有RecyclerView呢&#xff0c;我用ListView也能干所有的事情啊&#xff0c;尺有所短&#xff0c;寸有所长&#xff0c;先来看看Recycler…

案例与案例之间的非常规排版

In 1929 the Cond Nast publishing group brought Russian-born Mehemed Fehmy Agha—who had been working for the German edition of Vogue magazine—to America as art director for House & Garden, Vanity Fair, and the senior edition of Vogue.1929年&#xff0c…

熊猫分发_熊猫新手:第二部分

熊猫分发This article is a continuation of a previous article which kick-started the journey to learning Python for data analysis. You can check out the previous article here: Pandas for Newbies: An Introduction Part I.本文是上一篇文章的延续&#xff0c;该文…

浅析微信支付:申请退款、退款回调接口、查询退款

本文是【浅析微信支付】系列文章的第八篇&#xff0c;主要讲解商户如何处理微信申请退款、退款回调、查询退款接口&#xff0c;其中有一些坑的地方&#xff0c;会着重强调。 浅析微信支付系列已经更新七篇了哟&#xff5e;&#xff0c;没有看过的朋友们可以看一下哦。 浅析微信…

view工作原理-计算视图大小的过程(onMeasure)

view的视图有两种情况&#xff1a; 内容型视图&#xff1a;由视图的内容决定其大小。图形型视图&#xff1a;父视图为view动态调整大小。 ### measure的本质 把视图布局使用的“相对值”转化成具体值的过程&#xff0c;即把WRAP_CONTENT,MATCH_PARENT转化为具体的值。 measur…

[转载]使用.net 2003中的ngen.exe编译.net程序

ngen.exe程序为.net 2003自带&#xff0c; 在&#xff1a;/windows/microsoft.net/framework/v1.1.4322目录下ngen.exe ngen能把.net框架的东西编译成机器码.... 网友&#xff1a;Visual Studio .NET 2003程序的运行速度怎么样&#xff0c;我有一个感觉&#xff0c;V…

基于Redis实现分布式锁实战

背景在很多互联网产品应用中&#xff0c;有些场景需要加锁处理&#xff0c;比如&#xff1a;秒杀&#xff0c;全局递增ID&#xff0c;楼层生成等等。大部分的解决方案是基于DB实现的&#xff0c;Redis为单进程单线程模式&#xff0c;采用队列模式将并发访问变成串行访问&#x…

数据分析 绩效_如何在绩效改善中使用数据分析

数据分析 绩效Imagine you need to do a bank transaction, but the website is so slow. The page takes so much time to load, all you can see is a blue circle.想象您需要进行银行交易&#xff0c;但是网站是如此缓慢。 该页面需要花费很多时间来加载&#xff0c;您只能看…

隐私策略_隐私图标

隐私策略During its 2020 Worldwide Developers Conference, Apple spent time on one of today’s hottest topics — privacy. During the past couple of years, Apple has been rolling out various public campaigns aiming to position itself as a company that respect…