Summary

Completed

In this module, you learned how to move data between your C# programs and the file system.

You used the using statement and the File class to open files safely, letting C# close them automatically. You read data using File.ReadAllText(), File.ReadAllLines(), and line-by-line iteration with StreamReader, and chose the right approach for the situation. You wrote data using File.WriteAllText() when you wanted a fresh file, and File.AppendAllText() when you wanted to add to what was already there.

Tip

Nice work. You've completed every module in this getting-started series. Keep practicing by combining files, methods, and collections in your own C# projects.