Working with Files, Streams, and Serialization
This chapter is about reading and writing to files and streams, text encoding, and serialization. Applications that do not interact with a filesystem are extraordinarily rare. As a .NET developer, almost every application that you build will need to manage the filesystem and create, open, read, and write to and from files. Most of those files will contain text, so it is important to understand how text is encoded. And finally, after working with objects in memory, you will need to store them somewhere permanently for later reuse. You do that using a technique called serialization.
In this chapter, we will cover the following topics:
- Managing a filesystem
- Reading and writing with streams
- Encoding and decoding text
- Serializing object graphs