C# MemoryStream ToArray

Description

MemoryStream ToArray Writes the stream contents to a byte array, regardless of the Position property.

Syntax

MemoryStream.ToArray has the following syntax.


public virtual byte[] ToArray()

Returns

MemoryStream.ToArray method returns

Example


//from w w  w  .  j a v a 2 s  .c  o m
using System.IO;
using System;
public class MainClass{
  public static void Main(String[] argv){  
    MemoryStream memStream = new MemoryStream();
    byte[] array = memStream.ToArray();
    
  }
}




















Home »
  C# Tutorial »
    System.IO »




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