Unio 0.7.28
Requires NuGet 2.12 or higher.
dotnet add package Unio --version 0.7.28
NuGet\Install-Package Unio -Version 0.7.28
<PackageReference Include="Unio" Version="0.7.28" />
<PackageVersion Include="Unio" Version="0.7.28" />
<PackageReference Include="Unio" />
paket add Unio --version 0.7.28
#r "nuget: Unio, 0.7.28"
#:package Unio@0.7.28
#addin nuget:?package=Unio&version=0.7.28
#tool nuget:?package=Unio&version=0.7.28
Unio
High-performance discriminated unions for C#. Designed with strongly typed generic fields, full value equality semantics and allocation-free pattern matching for maximum performance and type safety.
Usage
using Unio;
// Implicit conversion
Unio<int, string> result = 42;
Unio<int, string> error = "not found";
// Exhaustive matching
string text = result.Match(
i => $"Number: {i}",
s => $"Text: {s}");
// Allocation-free matching - pass state instead of capturing variables
// (no closure object allocated per call)
string prefix = "Result";
string text2 = result.Match(prefix,
static (p, i) => $"{p}: {i}",
static (p, s) => $"{p}: {s}");
// Allocation-free side-effect switch
result.Switch((prefix, Console.Out),
static (s, i) => s.Out.WriteLine($"{s.prefix}: {i}"),
static (s, str) => s.Out.WriteLine($"{s.prefix}: {str}"));
// Safe TryGet pattern
if (result.TryGetT0(out int number))
Console.WriteLine(number);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Unio:
| Package | Downloads |
|---|---|
|
Unio.AspNetCore
Unio provides high-performance, struct-based discriminated unions for C#. Zero-allocation, exhaustive matching, Match, Switch and TryGet patterns and full value semantics. Simple, performant and scalable. |
|
|
Unio.Extensions
Unio provides high-performance, struct-based discriminated unions for C#. Zero-allocation, exhaustive matching, Match, Switch and TryGet patterns and full value semantics. Simple, performant and scalable. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.28 | 91 | 3/3/2026 |