Skip to content
David Cumps
Exam 70-536 study notes

BufferedStream Class

Part of my 2008 study notes for exam 70-536 (.NET Framework 2.0).

Overview

  • Provides a buffer for another Stream.
  • Used when the underlying stream is not very efficient at handling frequent calls.

Good practice

  • Remember to call Close on a stream.

Examples

Write to File

FileStream a = File.Create(@"C:\Public\TestBuff.txt");
BufferedStream b = new BufferedStream(a);
StreamWriter c = new StreamWriter(b);
 
c.WriteLine("Hello World");
c.WriteLine("Bye Bye!");
c.Close();

You May Also Like