Summary
We started this chapter with an overview of the System.IO
namespace and looked at the capabilities it provides for working with the filesystem. We then learned about handling paths and filesystem objects. We saw how we can create, edit, move, delete, or enumerate files and directories.
We have also seen how to read and write data from and to disk files with the help of streams. We looked at different kinds of streams and learned about writing and reading to and from file and memory streams using different stream adapters.
In the last part of this chapter, we looked at data serialization and learned how to serialize and deserialize XML and JSON. For the latter, we explored the Json.NET serializer, which is the most popular .NET library for JSON, and System.Text.Json
, the new .NET library for JSON.
In the next chapter, we will address a different topic called error handling. You will learn about error codes and exceptions and what best practices for handling errors a...