Stage 1 · Lesson 9 of 9
Namespaces and reading files
group related classes under one name. Write a file-scoped namespace Budget; line at the top of each file, and add a using directive to reach classes from elsewhere. New projects also turn on implicit , so common namespaces such as System.IO are already available.
For reading files, File.ReadAllLines("data.csv") returns a string array, and File.ReadLines streams the lines one by one for large files. Both throw FileNotFoundException when the path is wrong. are worked out from the current working directory.
That folder can differ between dotnet run in a terminal and the run button in an . Split each line, parse the fields with TryParse and build objects from them: that is the core of the milestone.
A question to check yourself, an AI practice session and 2 cheat sheet entries come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- GuideFreeLearn C#
Microsoft · Beginner
Official C# fundamentals tutorials that you run locally with the .NET SDK
- PlatformFreefreeCodeCamp
freeCodeCamp · Beginner
Free Foundational C# certification, built with Microsoft, with a graded exam at the end