I've been writing C# for over a decade. Most version bumps feel like Microsoft checking boxes. C# 15 is different. Two features landed that I'll actually use in production code.
Hi, my name is Tom Smykowski, I'm a staff full-stack engineer. I build and scale SaaS platforms to millions of users, working end-to-end from system architecture to frontend to mobile. On this blog I share practical insights about programming languages and software development.
Let me walk you through what changed and why it matters for your daily work.
Collection Expressions Got Their Missing Piece
Collection expressions were a hit when they shipped. Everyone loved the clean [] syntax. But there was an annoying limitation that kept bugging me.
You couldn't configure the collection during creation.
Building a dictionary with a specific capacity? Nope, back to constructor calls. Creating a sorted set with custom ordering? Same story. The pretty syntax forced you into default behavior.
C# 15 introduces the with(...) clause that changes everything. Now you can specify capacity upfront, use custom comparers, and configure collections at the point of creation.
Discriminated Unions Are Here
This is what I've wanted for years. Proper union types in C#.
If you've touched F#, Rust, or even TypeScript, you understand the concept. A value that holds exactly one option from a fixed set. Not polymorphism. Not marker interfaces. Just "this thing is X or Y or Z, nothing else."
The compiler now enforces exhaustive pattern matching. Delete a case handler? Compiler error. Add a new union member? Every switch expression breaks until you handle it.
Bugs caught during compilation cost nothing. Bugs caught in production cost everything.
