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.pswp.cn/news/389169.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/389169.shtml
英文地址,請注明出處:http://en.pswp.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…