This chapter provided a brief introduction to input and output streams and how they are used to write to and read from files.
The important points discussed are reviewed in this section.
I/O stands for program input and program output.
Program input refers to data flowing into a program and is handled by input streams from which the program can read.
Program output refers to data flowing out of a program and is handled by output streams to which the program can write.
In C# and .NET, streams and files can be abstracted into objects of classes that reside in the System.IO namespace. This makes it easier to perform file I/O.
Any file consists of one long sequence of bits positioned one after the other. Depending on their interpretation, some files are named text files (accessed via character streams or binary streams) while other files are named binary files (only accessed via binary streams).
The FileInfo, StreamWriter, StreamReader, and FileStream classes are commonly used for manipulating files and for performing file I/O. FileInfo represents a file in your computer's file system, StreamWriter and StreamReader represent character streams, and FileStream represents binary streams. The System.IO namespace contains many other useful classes targeted at interacting with the underlying file system and for performing I/O.