Mono Class Library: System.IO Namespace

System.IO.MemoryStream Class

Provides support for creating and using a stream whose backing store is memory. [Edit]

See Also: MemoryStream Members

System.Object
     System.MarshalByRefObject
          System.IO.Stream
               System.IO.MemoryStream

[System.Runtime.InteropServices.ComVisible(true)]
public class MemoryStream : Stream

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.

Remarks

The System.IO.MemoryStream class creates streams that have memory as a backing store instead of a disk or a network connection. System.IO.MemoryStream encapsulates data stored as an unsigned byte array. The encapsulated data is directly accessible in memory. Memory streams can reduce the need for temporary buffers and files in an application.

The current position of a stream is the position at which the next read or write operation takes place. The current position can be retrieved or set through the MemoryStream.Seek(long, SeekOrigin) method. When a new instance of System.IO.MemoryStream is created, the current position is set to zero.

The maximum length of a System.IO.MemoryStream is implementation-specific.

Note: Memory streams created with an unsigned byte array provide a non-resizable stream view of the data. When using a byte array, you can neither append to nor shrink the stream, although you might be able to modify the existing contents depending on the parameters passed into the constructor.

[Edit]

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0