This lesson uses file reading and writing as a vehicle to illustrate important data validation concepts when mapping text data to objects and receiving user input. It demonstrates many of the essential elements present in business applications, that is: ingesting data from an external source, enabling users to modify that data, and saving the data back to permanent storage.
Robust and well-designed apps, especially concerning the user interface, need to validate input in terms of data format and applicability and provide feedback when entered data is not appropriate. We round off the lesson by implementing the data access layer design pattern that will enable the code to be easily adapted to other data sources.
This lesson is ideal for anyone who already has some basic knowledge of C# and is looking to expand on that by learning about lists and files within the programming language.
The ideal prerequisite for this lesson is our C# Loops Deep Dive lesson, but if you know what the .NET List class is and how to create one, then you’ll be able to follow along with these lectures and demonstrations.
Demo source code: https://github.com/cloudacademy/csharp-lists-and-files