MemoryStream. The MemoryStream creates a stream whose backing store is memory. Actually, it represents a pure, inmemory stream of data. Memory is much faster when compared to disk or network accesses. public ref class MemoryStream: System: : IO: : Stream Try ' Write the first string to the stream. 0, firstString. Length) ' Write the second string to the stream, byte by byte. count 0 While(count secondString.
Length) count 1 End While ' Write the stream Except for a MemoryStream constructed with a byte[ parameter, write operations at the end of a MemoryStream expand the MemoryStream. See Also File and Stream IO Oct 12, 2010 I was Looking at some code examples for MemoryStream.
this is what i found: Except for a MemoryStream constructed with a byte[ parameter, write operations at the end of a MemoryStream expand the MemoryStream. This constructor exposes the underlying stream that GetBuffer returns. I am not sure what I am doing wrong, have seen a lot of examples, but can't seem to get this working. public static Stream Foo() var memStream new MemoryStream(); var streamWriter new You can create an XmlWriter that writes to a memory stream:.
var stream new MemoryStream(); var writer Now you can pass this stream to your EncryptFile function instead of an inputFile. You have to make sure that you don't forget these two things before reading the stream: