user@runtime:~/blog$ grep -l "pattern-matching" posts/*.md

pattern-matching

4 posts tagged with pattern-matching.

2026-07-11 10m

Closed Class Hierarchies in C# 15: Exhaustive Matching Comes to Inheritance

C# 15 introduces the closed modifier for class hierarchies, restricting derivation to the declaring assembly and enabling exhaustive switch expressions without a default arm. Here is how it works, how it differs from unions and sealed classes, and where it fits in domain modelling.

2026-04-02 10m

Union Types in C# 15: Exhaustive Pattern Matching Without the Workarounds

C# 15 introduces union types with the union keyword, bringing implicit conversions, exhaustive switch expressions, and compiler-enforced closed type sets to .NET. Here is what they look like, how they lower to structs, and where they replace the OneOf hacks.

2025-06-23 4m

Switch Expressions: Concise Branching in C#

How switch expressions replace verbose switch statements with concise, expression-based branching that returns values directly.

2025-06-02 4m

Pattern Matching Deep Dive in C#

A comprehensive look at C# pattern matching, from type patterns to recursive and relational patterns that simplify complex conditional logic.