In this chapter, you learned about streams and why they are used in the .NET Framework to access files and other serial devices. You looked at the basic classes in the the System.IO namespace, including:
File
FileInfo
FileStream
You saw that the File class exposes many static methods for moving, copying, and deleting files, FileInfo represents a physical file on disk, and has methods to manipulate this file. A FileStream object represents a file that can be written to, or read from, or both. You also explored StreamReader and StreamWriter classes and saw how useful they were for writing to streams. You saw how to read and write to random files using the FileStream class. Building on this knowledge, you used classes in the System.IO.Compression namespace to compress streams as you write them to disk and also saw how to serialize objects to files. Finally, you built an entire application to monitor files and directories using the FileSystemWatcher class.
In summary, you covered
Opening a file
Reading from a file
Writing to a file
The difference between the StreamWriter and StreamReader classes and the FileStream class
Working with delimited files to populate a data structure
Compressing and decompressing streams
Serializing and deserializing objects
Monitoring the file system with the FileSystemWatcher class