Jon
Mon Sep 05 13:59:17 CDT 2005
BeanDog <BeanDog@discussions.microsoft.com> wrote:
> I have some libraries that will write to a stream. I would like them to write
> to a string, which I can then manipulate in memory, rather than to a file. I
> cannot find documentation for how to get a stream that writes to or reads
> from a string.
>
> Is such functionality available?
>
> Thanks!
Streams contain binary data - strings are text data. You can use a
MemoryStream to keep the data in memory, and then if you *know* that
the contents are a string encoded in a certain way, you could convert
the data to a string later. You shouldn't use a string as a way of
storing binary data though - byte arrays should be used for that
purpose.
--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too