Reading and Writing to Files and Streams

As programmers, we often have to write directly to a file or data stream. If you've communicated with disparate systems, you are undoubtedly familiar with writing out CSV or XML files as a means of exchanging data. The .NET Framework gives us a group of classes and methods inside the System.IO namespace that allows us to access data streams and files both synchronously and asynchronously.

This section will define the AppendText, CreateText, Open, OpenRead, and OpenWrite methods of the FileInfo class.

File and data streams are essentially the same thing. They both are a type of stream. Their differences lie in their backing store. Backing store refers to a storage medium, such as a disk, tape, memory, network, ...

Get Visual Basic® Programmer's Guide to the .NET Framework Class Library 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.