The Need for Files

Why do we need files? You have already used the Console.ReadLine and Console.WriteLine methods numerous times to receive input from the keyboard and send output to the screen. However, the keyboard and screen data are only very temporary; as soon as the program terminates, all the data is lost. On the other hand, files allow you to store data permanently after the program has ended and after the computer is switched off. A file's content can be used repeatedly by the same or by different programs, and files allow you to handle large amounts of data in a convenient fashion.

Get C# Primer Plus 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.