This repo is the source beind two packages available on Nuget.
-
UnionTypes.Toolkit - a library of common custom union types
-
UnionTypes.Toolkit.Generator - a source generator for non-boxing custom unions
This repo was originally created as a design playground when working on the C# Union Types feature. It was meant to contain various hand built union types with a variety of implementation strategies and a general configurable source generator that would produce custom unions using the techniques being discussed during design meetings. This was long before any actual design was settled on and language feature worked started.
The original nuget release years ago contained a very different concept of unions to what has now become a feature for C# 15.
Both the toolkit library and the source generator have been updated to match the new C# Union Types feature, and both are now available for general use.
The source generator has been retrofitted to produce only unions matching the specification for C# Union Types feature and using the Custom Unions API's. The generator produces unions that do not box struct values by default.
To learn more about how to use the packages built by this repo, follow these links.
Please report bugs here under issues or submit PRs to fix them if you prefer.
Use discussions instead of issues to share ideas or make requests.