Working with Files, Streams, and Serialization

This chapter is about reading and writing to files and streams, text encoding, and serialization. We will be covering the following topics:

  • Managing the filesystem
  • Reading and writing with streams
  • Encoding and decoding text
  • Serializing object graphs

Managing the filesystem

Your applications will often need to perform input and output with files and directories in different environments. The System and System.IO namespaces contain classes for this purpose.

Handling cross-platform environments and filesystems

Let's explore how to handle cross-platform environments like the differences between Windows and Linux or macOS:

  1. Create a new console application named WorkingWithFileSystems in a folder ...

Get C# 9 and .NET 5 - Modern Cross-Platform Development - Fifth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.