tags:

views:

43

answers:

1

I know about the ADODB.Stream object.

But what I really want is a Stream for which calls to Write() are no-ops. Like System.IO.Stream.Null. I think ADODB.Stream is more like a MemoryStream, which accumulates the data in memory.

And I cannot create an instance of System.IO.Stream.Null from COM, because it is a static property on the Stream class, thus inaccessible from COM. Or can I? (without writing a wrapper class)

+3  A: 

There's no default implementation like this. However, assuming that the code that needs this stream will use the IStream interfaces, you can take an existing instance of IStream and wrap it in your own implementation of IStream, with the CopyTo/Write calls implemented as a no-op. It should be relatively trivial to create a simple COM object for such a wrapper.

Franci Penov