Constructs and initializes a new instance of the System.IO.MemoryStream class.
- buffer
- The byte array from which to create the new stream.
- index
- A int that specifies the index into buffer at which the stream begins.
- count
- A int that specifies the length of the stream in bytes.
- writable
- A bool that specifies whether the new stream instance supports writing.
- publiclyVisible
- A bool that specifies whether buffer is exposed via MemoryStream.GetBuffer, which returns the byte array from which the stream was created. Specify true to expose buffer; otherwise, specify false.
Type Reason ArgumentNullException buffer is null. ArgumentOutOfRangeException index or count is negative. ArgumentException (index + count ) is greater than the length of buffer.
The MemoryStream.CanRead and MemoryStream.CanSeek properties of the new System.IO.MemoryStream instance are set to true. The MemoryStream.Capacity property is set to count. The Stream.CanWrite property is set to writable.
Note: The new stream instance can be written to depending on the value of writable, but the MemoryStream.Capacity of the underlying byte array cannot be changed. The length of the stream cannot be set to a value larger than MemoryStream.Capacity, but the stream can be truncated (see MemoryStream.SetLength(long)).
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0