Chapter 10. Working with Files, Streams, and Serialization
This chapter is about reading and writing to files and streams, text encoding, and serialization.
This chapter will cover the following topics:
- Managing the filesystem
- Reading and writing with streams
- Encoding text
- Serializing object graphs
Managing the filesystem
Your applications will often need to perform input and output with files and directories. The System.IO
namespace contains classes for this purpose.
Managing directories
In Visual Studio 2017, press Ctrl + Shift + N or choose File | New | Project....
In the New Project dialog, in the Installed | Templates list, select .NET Core. In the center list, select Console App (.NET Core), type Name as Ch10_FileSystem
, change the location to C:\Code ...
Get C# 7 and .NET Core: Modern Cross-Platform Development - Second 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.