Build useful C# programs with lists, dictionaries, your own classes, LINQ, exceptions and files.
- 28 lessons
- 7 units
- 4 h 38 m in all
- £0, for good
what’s inside.
For people who finished Level 1, or can already write small programs with variables, decisions, loops and functions.
C# Level 2 picks up where Level 1 ended and puts your skills to work on small, real programs. In 28 lessons you master lists and dictionaries, design classes, interfaces, enums and records, question your data with LINQ, handle problems with exceptions and null, and save your work in files. It ends with a level check: a budget tracker you drive with typed commands, which keeps its entries safe in a file.
every lesson goes the same way.
- meet it
- guess first
- your turn
- fix it
- nailed it
unit 1
Lists and dictionaries
Keep as many things as you like, and look them up by name.
unit 2
Your own classes
Design your own kinds of thing, with data and actions inside.
- A class is a blueprint10 minDesign your own type and build objects from it.
- Constructors10 minFill in a new object the moment it is built.
- Methods and ToString10 minGive objects actions, and decide how they print.
- Properties guard your data11 minLet everyone read a value, but only the class change it.
unit 3
Families of classes
Share code between related classes and promise what they can do.
unit 4
Choices and records
Name a fixed set of choices, branch on them and keep data tidy.
unit 5
Ask your data questions
Filter, reshape, sort and sum a list, each in a single line.
unit 6
When things go wrong
Catch problems, throw your own and keep your program running.
- Catching a problem10 minHandle an exception and keep the program going.
- More catches and finally10 minHandle each kind of problem, and always tidy up.
- Throwing a problem10 minRefuse bad values by throwing an exception yourself.
- Your own exception class10 minName your app's problems so callers can catch them.
unit 7
Save your work
Handle missing values, tidy your output and keep it in files.
- When nothing is there: null10 minReach into objects safely, even when they are missing.
- Tidy numbers and columns10 minShow money properly and line up your columns.
- Writing and reading a file10 minKeep text safe after the program ends.
- One line per record11 minAdd to a file line by line, and read it back in parts.