Resultron 1.4.1

dotnet add package Resultron --version 1.4.1
                    
NuGet\Install-Package Resultron -Version 1.4.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Resultron" Version="1.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Resultron" Version="1.4.1" />
                    
Directory.Packages.props
<PackageReference Include="Resultron" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Resultron --version 1.4.1
                    
#r "nuget: Resultron, 1.4.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Resultron@1.4.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Resultron&version=1.4.1
                    
Install as a Cake Addin
#tool nuget:?package=Resultron&version=1.4.1
                    
Install as a Cake Tool

Resultron

Resultron is a lightweight, fluent, and functional-style Result library for C#.
It provides Result and Result<T> types with Try, Map, Bind, and Match operations,
enabling safe error handling, fluent pipelines, and exception-free code.

NuGet License GitHub Build


Why Resultron?

Exceptions can make control flow unpredictable and expensive.
Resultron provides a functional approach to error handling with explicit success and failure states.

Features

  • Fluent API with Try, TryAsync, Map, Bind, Match
  • Non-generic and generic Result types
  • Exception-safe operations with Result.Try and Result.TryAsync
  • Fully chainable pipelines for functional programming style
  • Structured errors with Code and Description

Installation

You can install the package via NuGet:

dotnet add package Resultron

Quick Example

string input = "10";

var message =
    Result.Try(() => int.Parse(input))
        .Bind(x => Result.Success(x * 2))
        .Match(
            onSuccess: value => $"Result: {value}",
            onFailure: error => $"Error: {error.Description}"
        );

Console.WriteLine(message); // Result: 20

Chaining Example

var result = Result.Success()
    .Bind(ValidateName)
    .Bind(ValidateEmail)
    .Bind(SaveUser)
    .Match(
        onSuccess: () => "User created successfully.",
        onFailure: error => $"Failed: {error.Description}"
    );

Async Example

var result = await Result.TryAsync(async () =>
{
    await _repository.SaveAsync(entity);
});

result.Match(
    onSuccess: () => Console.WriteLine("Saved."),
    onFailure: error => Console.WriteLine($"Error: {error.Description}")
);

Documentation

See the full documentation.

Contributing

Please read CONTRIBUTING.md before submitting pull requests.

Changelog

See CHANGELOG.md for release history.

License

MIT License — see LICENSE.

Code of Conduct

See CODE_OF_CONDUCT.md.

Security

See SECURITY.md.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.1 94 8/27/2026
1.3.1 98 8/25/2026
1.2.1 125 7/20/2026
1.1.1 124 5/25/2026
1.0.0 117 5/25/2026