The way you write dotnet is about to fundamentally change
summary
Claim: adding discriminating unions to C# gives compiler-enforced closed types so pattern matching is exhaustive and many runtime "unknown value" bugs disappear. Tools demonstrated: records + with expressions for immutability, pattern matching switch expressions, Option and Result union types to replace nulls and exceptions, and the minimal API IResult emulating unions. Concrete failures: enum deserialization caused a switch exception during a blue/green deploy; dunet library plus source generators do work today (serialization included), but the proposal sits seven years and 785 comments.
AI-written summary · about
chapters (12)
- 0:00Introduction and thanks
- 1:06Future of .NET development
- 3:35Pattern matching in C#
- 5:24Records and immutability
- 11:52Discriminating unions explained
- 17:11Exhaustive checks and closed types
- 22:30Option type vs nullability
- 24:36Result type and exceptions
- 26:19Minimal APIs and typed results
- 32:54Current union limitations
- 33:56Records and pattern matching benefits
- 34:38Future outlook and closing
