Framwork Class Library

Framwork Class Library - Chapter 3 The.NET Framework Class...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 3 The .NET Framework Class Library (FCL)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
  File and Stream I/O   FCL provides the API that managed applications write to. 100 hierarchically organized namespaces and more than 7,000 types. File and Stream I/O A stream is an abstract representation of byte-oriented data. Stream classes have methods that you can call to perform input and output. An additional level of abstraction: readers and writers.
Background image of page 2
General Procedure 1. Open the file using a FileStream object. 2. For binary reads and writes, wrap instances of BinaryReader and BinaryWriter around the FileStream object and call BinaryReader and BinaryWriter methods such as Read and Write to perform input and output. 3. For reads and writes involving text, wrap a StreamReader and StreamWriter around the FileStream object and use StreamReader and StreamWriter methods such as ReadLine and WriteLine to perform input and output. 4. Close the FileStream object. File and Stream I/O
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
File and Stream I/O Code StreamReader reader = new StreamReader (filename); for (string line = reader.ReadLine (); line != null; line = reader.ReadLine ()) Console.WriteLine (line); reader.Close ();
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 11

Framwork Class Library - Chapter 3 The.NET Framework Class...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online