...

/

Writing Files

Writing Files

Write to files without causing memory leaks.

We'll cover the following...

Introduction

The FileStream instance implements the IDisposable interface, so we must release the unmanaged resources after we’re done using the instance. In this lesson, we’ll look at how to write data to a file and read it back.

Encode and decode

If we want to write something to a file, we must convert it to an array of bytes. The specific means of converting a data type to a byte[] object varies ...