C# MemoryStream MemoryStream(Byte[], Int32, Int32)
Description
MemoryStream MemoryStream(Byte[], Int32, Int32)
Initializes
a new non-resizable instance of the MemoryStream class based on the specified
region (index) of a byte array.
Syntax
MemoryStream.MemoryStream(Byte[], Int32, Int32)
has the following syntax.
public MemoryStream(
byte[] buffer,/*from w ww .j ava 2 s .c o m*/
int index,
int count
)
Parameters
MemoryStream.MemoryStream(Byte[], Int32, Int32)
has the following 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.
Example
using System.IO;//from w w w.j a v a 2 s . c o m
using System;
public class MainClass{
public static void Main(String[] argv){
MemoryStream ms = new MemoryStream(new byte[]{1,2,3},0,2);
System.Console.WriteLine(ms.CanRead);
}
}
The code above generates the following result.