是否有跨越的ADODB.Stream和的System.IO.Stream之间的COM / .NET界限的可能性互操作? [英] Is there any possibility for Interop across a COM/.NET boundary between ADODB.Stream and System.IO.Stream?

查看:171
本文介绍了是否有跨越的ADODB.Stream和的System.IO.Stream之间的COM / .NET界限的可能性互操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个COM可调用包装的.NET程序集。某些方法使用流(的System.IO.Stream):或者他们接受的System.IO.Stream作为输入,或它们返回的System.IO.Stream。

I have a COM-Callable Wrapper on a .NET assembly. Some of the methods use streams (System.IO.Stream): either they accept a System.IO.Stream as input, or they return a System.IO.Stream .

我想调用从COM环境的方法之一 - 经典ASP。

I'd like to call one of those methods from a COM environment - Classic ASP.

是否有可能使用的ADODB.Stream获得互操作性?换句话说,我希望来调用COM包装的方法,并取回,而不是一个的System.IO.Stream,的ADODB.Stream的一个实例。

Is there any possibility to get interop using ADODB.Stream? In other words, I'd like to invoke a method on the COM wrapper and get back, instead of a System.IO.Stream , an instance of ADODB.Stream.

这是否自动发生?


如果没有,那么我可以构建.NET code,以便它呢?如果是这样,怎么样? 我想这样做:在房子的.NET方,要求一个的ADODB.Stream的CreateInstance,其包装围绕现有的System.IO.Stream,然后的ADODB.Stream的情况下返回到COM调用者。这可能吗?将它的工作?

If not, then can I construct the .NET code so that it does? If so, how? I imagine doing this: on the .NET side of the house, calling CreateInstance on an ADODB.Stream, wrapping it around the existing System.IO.Stream and then returning the instance of the ADODB.Stream to the COM caller. Is this possible? Will it work?

推荐答案

这是两个不同的对象。它们具有相同的接口,当然,但你不能施放一个到另一个。

They are two different objects. They have the same interface, sure, but you can not cast one to another.

您可以用code,它从一个读取,然后写入到另一个使用他们的IStream接口单元(读取缓冲然后写入到另一个流,直到有没有更多的数据),如果你要复制的数据。或者你也可以通过转发呼叫的ADODB.Stream创建一个使用的ADODB.Stream作为数据存储从的System.IO.Stream类。

You can write code that read from one and then write to another using their IStream interfacer (read to buffer then write to the other stream until there's no more data), if you want to copy the data. Or you can create a class from System.IO.Stream that uses a ADODB.Stream as the data store by forwarding calls to ADODB.Stream.

这篇关于是否有跨越的ADODB.Stream和的System.IO.Stream之间的COM / .NET界限的可能性互操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆