DigiNews

Tech Watch by Johan Denoyer

← Back to articles

.NET (OK, C#) finally gets union types🎉

Quality: 8/10 Relevance: 9/10

Summary

Andrew Lock explains union types in .NET 11 preview 2 (C# 15), what union types are, and how to declare and use them with the union keyword. The post covers enabling language preview, basic usage with examples, and how the compiler generates code, including an IUnion interface and UnionAttribute. It also discusses boxing concerns and the option to implement custom, non-boxing unions.

🚀 Service construit par Johan Denoyer