9

Working with Files, Streams, and Serialization

This chapter is about reading and writing to files and streams, text encoding, and serialization.

We will cover the following topics:

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

Managing the filesystem

Your applications will often need to perform input and output operations 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 and the differences between Windows and Linux or macOS. Paths are different for ...

Get C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals - Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.