NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MemoryStream Constructor (Byte[], Int32, Int32)

Initializes a new MemoryStream based on the specified region (index) of a byte array.

[Visual Basic]
Overloads Public Sub New( _
   ByVal buffer() As Byte, _
   ByVal index As Integer, _
   ByVal count As Integer _
)
[C#]
public MemoryStream(
   byte[] buffer,
   int index,
   int count
);
[C++]
public: MemoryStream(
   unsigned char* buffer[],
   int index,
   int count
);
[JScript]
public function MemoryStream(
   buffer : Byte[],
   index : int,
   count : int
);

Parameters

buffer
The array of unsigned bytes from which to create this stream.
index
The index into buffer at which the stream begins.
count
The length of the stream in bytes.

Exceptions

Exception Type Condition
ArgumentNullException buffer is null.
ArgumentOutOfRangeException index or count is less than zero.
ArgumentException The sum of index and count is greater than the length of buffer.

Remarks

The CanRead, CanSeek, and CanWrite properties are all set to true, but the capacity cannot be changed.

The length of the stream cannot be set to a value greater than the initial length of the specified byte array; however, the stream can be truncated (see SetLength).

This constructor does not expose the underlying stream. GetBuffer throws AccessException. However, the stream is writeable.

See Also

MemoryStream Class | MemoryStream Members | System.IO Namespace | MemoryStream Constructor Overload List