Provides a way to create streams that have memory as a backing store instead of a disk or a network connection. The MemoryStream class creates a stream out of an array of bytes.
[Visual Basic] Public Class MemoryStream Inherits Stream [C#] public class MemoryStream : Stream [C++] public __gc class MemoryStream : public Stream [JScript] public class MemoryStream extends Stream
MemoryStream encapsulates data stored as an unsigned byte array that is initialized upon creation of a MemoryStream object, or it can be created as empty. The encapsulated data is directly accessible in memory. Memory streams might reduce the need for temporary buffers and files in an application.
Memory streams created with an unsigned byte array provide a non-resizable stream "view" of the data, and can only be written to. When using a byte array, you can neither append to nor shrink the stream, but depending on the parameters passed into the constructor, you may be able to modify the existing contents. Empty memory streams are resizable, and can be written to and read from.
Namespace: System.IO
Assembly: mscorlib.dll