17.1 Introduction

Variables and arrays offer only temporary storage of data—the data is lost when a local variable “goes out of scope” or when the program terminates. By contrast, files (and databases, which we cover in Chapter 22) are used for long-term retention of large amounts of data, even after the program that created the data terminates. Data maintained in files often is called persistent data. Computers store files on secondary storage devices, such as hard drives, solid-state drives, flash drives, DVDs and tapes. In this chapter, we explain how to create, update and process data files in C# programs.

We overview some of the Framework Class Library’s file-processing classes. We then create Windows Forms apps that write to and read from text files that are human readable and binary files that store entire objects in binary format. Finally, we present examples that show how you can determine information about the files and directories on your computer.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset