This is the second post in the series: Exploring the .NET 11 preview. Part 1 - Running background tasks in Blazor with Web WorkersPart 2 - .NET finally gets union types🎉 (this post) Unions are one of those features that have been requested for years, and in .NET 11 (or rather, C# 15) they're finally here. In this post I describe what that support looks like, how you can use them, how they're implemented, and how you can implement your own custom types. This post was written using the features available in .NET 11 preview 4. Many things may change between now and the final release of .NET 11. What are union types? Unions are one of those basic data structures which are used all the time in the functional programming world; they're available in F#, TypeScript, Rust…pretty much any functional-first language. There are many different types of union, but at their core they allow having a type that can represent two different things. Some of the simplest union types are the Option<T> and…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.