Stage 1 · Lesson 5 of 7
Records and pattern matching
are types built for data. public record OrderDto(int Id, decimal Total); gives you a constructor, read-only properties, value equality and a readable ToString, and with makes a changed copy. They are ideal for API requests and responses, events and value objects, but not for EF Core entities, which need rather than value equality.
tests the shape of a value: its type, a constant, a range or its properties. A switch expression turns a long if/else chain into a short list of cases, and the compiler warns when you miss an enum value. Fee rules, status transitions and discount tiers read much better this way.
Newer features such as and ([1, 2, 3]) also appear in modern code.
Common trapputting the catch-all _ case first, so nothing below it ever runs.
A question to check yourself, an AI practice session and 4 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- GuideFreeLearn C#
Microsoft · Beginner
Free official C# path: syntax, types, classes, collections and exceptions with in-browser exercises
- GuideFree.NET documentation
Microsoft
The official .NET docs: start with the CLI overview, project files and the C# language tour
Practise
Keep handy
Also worth your time
The features that ship with .NET 10: extension members, the field keyword and null-conditional assignment
Object-oriented design worked through on real systems: classes, relationships and responsibilities
- Refactoring.Guru: Design PatternsGo deeper
Free: the classic design patterns explained with diagrams and C# examples