CSharp examples for File IO:MemoryStream
Create memory stream
using System;/* w w w .j a v a 2 s .co m*/ using System.IO; public class Program { public static void Main(string[] args) { string data = "test/ntest/ntest/n"; // \n equiv to 2 bytes, so 18 bytes. Console.WriteLine("Original data:\n{0}", data); byte[] buffer = new byte[data.Length + 20]; MemoryStream ms = new MemoryStream(buffer); Console.WriteLine("Stream capacity: {0}", ms.Capacity); Console.WriteLine("Write data to the stream.\n"); } }