FileStream Class

Overview

  • Provides a file specific implementation of a Stream.

Good practice

  • Remember to call Close on a stream.

Examples

Read a File

// FileStream is simply a stream around a file, overriding Stream methods
FileStream a = new FileStream(@"C:\Public\Test.txt", FileMode.Open);
 
while (a.Position != a.Length)
{
    Console.Write((char)a.ReadByte());
}