C# MemoryStream MemoryStream(Byte[])

Description

MemoryStream MemoryStream(Byte[]) Initializes a new non-resizable instance of the MemoryStream class based on the specified byte array.

Syntax

MemoryStream.MemoryStream(Byte[]) has the following syntax.


public MemoryStream(
  byte[] buffer
)

Parameters

MemoryStream.MemoryStream(Byte[]) has the following parameters.

  • buffer - The array of unsigned bytes from which to create the current stream.

Example


/*from w  w w . jav a 2s. c  o m*/

using System.IO;
using System;
public class MainClass{
  public static void Main(String[] argv){  
    MemoryStream ms = new MemoryStream(new byte[]{1,2,3,4});
    System.Console.WriteLine(ms.CanRead);
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter