March 2022
Intermediate to advanced
864 pages
19h 46m
English
Content preview from C# 10.0 All-in-One For Dummies
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
Start your free trial



Chapter 3
Fishing the File Stream
IN THIS CHAPTER
Reading and writing data files
Using the Stream classes
Using the using statement
Dealing with input/output errors
Catching fish in a stream can prove to be quite a thrill to those who engage in fishing. Anglers often boast of the difficulty of getting that one special fish out of the stream and into a basket. Fishing the “file stream” with C# isn't quite so thrilling, but it’s one of those indispensable programming skills.
File access refers to the storage and retrieval of data on the disk. This chapter covers basic text-file input/output. Reading and writing data from databases are covered in Chapter 2 of this minibook, and reading and writing information to the Internet are covered in Chapter 4.
You don’t have to type the source code for this chapter manually. In fact, using the downloadable source is a lot easier. You can find the source for this chapter in the