TedToolkit.Results
2026.8.4
dotnet add package TedToolkit.Results --version 2026.8.4
NuGet\Install-Package TedToolkit.Results -Version 2026.8.4
<PackageReference Include="TedToolkit.Results" Version="2026.8.4" />
<PackageVersion Include="TedToolkit.Results" Version="2026.8.4" />
<PackageReference Include="TedToolkit.Results" />
paket add TedToolkit.Results --version 2026.8.4
#r "nuget: TedToolkit.Results, 2026.8.4"
#:package TedToolkit.Results@2026.8.4
#addin nuget:?package=TedToolkit.Results&version=2026.8.4
#tool nuget:?package=TedToolkit.Results&version=2026.8.4
TedToolkit.Results
TedToolkit.Results provides immutable result value records for representing an operation as either a
success value or an enum failure reason.
Install
dotnet add package TedToolkit.Results
Use
using TedToolkit.Results;
var success = Result.Succeed<string, SaveFailure>("document.json");
if (success)
{
Console.WriteLine(success.Value);
}
Result<string, SaveFailure> failure = SaveFailure.InvalidDocument;
Console.WriteLine(failure.FailureReason);
enum SaveFailure
{
InvalidDocument,
}
A result has exactly one active branch. Reading Value from a failed result or
FailureReason from a successful result throws InvalidOperationException.
Result<TValue, TFailure> is a readonly value type. Its default value is uninitialized:
Result<string, SaveFailure> result = default;
Console.WriteLine(result.IsInitialized); // false
Reading branch-dependent members or formatting an uninitialized result throws
InvalidOperationException.
Consume Branches
Use if (result) for success and if (!result) for failure. These operators have the same branch
semantics as IsSuccess and IsFailure; Result is not generally convertible to bool.
if (!result)
{
Console.WriteLine(result.FailureReason);
}
Install TedToolkit.Results.Composition for Match,
TryGetValue, TryGetFailure, deconstruction, and synchronous, Task, or collection pipelines. The
core package intentionally keeps these transferable conveniences outside the value contract. JSON
and ASP.NET Core adapters are also separate optional packages.
Create Results
Use the non-generic factory when the result type is explicit at the call site:
var success = Result.Succeed<string, SaveFailure>("document.json");
var failure = Result.Fail<string, SaveFailure>(SaveFailure.InvalidDocument);
Constructors and implicit conversions provide equivalent behavior:
Result<string, SaveFailure> success = "document.json";
Result<string, SaveFailure> failure = SaveFailure.InvalidDocument;
Success values may be null when TValue is nullable. TFailure must be an enum value type.
Read Results
IsInitializedsafely identifies whether either branch is active.IsSuccessidentifies the active branch.Valuereturns the success value.FailureReasonreturns the failure enum.- An explicit conversion returns the success value and follows the same branch validation as
Value.
Result<string, SaveFailure> result = "document.json";
var fileName = (string)result;
Because Result<TValue, TFailure> is a record struct, equality compares the active branch and its
contained value.
Diagnostic Text
ToString() prefixes successes with ✅ and failures with ❌:
✅ document.json
❌ InvalidDocument
This text is for logs and debugging only. It is not a serialization, persistence, localization, or user-interface contract.
Internationalization
The package does not hard-code localized presentation text. Source, runtime messages, documentation, and examples use English, while consumer-provided success values remain normal Unicode-capable .NET values. Applications own any locale-specific user-interface text.
Target Frameworks
net6.0net7.0net8.0net9.0net10.0net472net48netstandard2.0netstandard2.1
License
Licensed under LGPL-3.0.
Related Documentation
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on TedToolkit.Results:
| Package | Downloads |
|---|---|
|
TedToolkit.Results.Composition
Optional Task and collection composition extensions for TedToolkit Results. |
|
|
TedToolkit.Results.SystemTextJson
System.Text.Json converters for TedToolkit Results. |
|
|
TedToolkit.Results.AspNetCore
ASP.NET Core MVC and minimal API adapters for TedToolkit Results. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.8.4 | 161 | 8/4/2026 |