ResultKit 9.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ResultKit --version 9.0.1
                    
NuGet\Install-Package ResultKit -Version 9.0.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="ResultKit" Version="9.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ResultKit" Version="9.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ResultKit" />
                    
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 ResultKit --version 9.0.1
                    
#r "nuget: ResultKit, 9.0.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 ResultKit@9.0.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=ResultKit&version=9.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ResultKit&version=9.0.1
                    
Install as a Cake Tool

<div align="center"> <img src="assets/logo-1250x1250.png" width="120" alt="ResultKit logo" />

ResultKit

A Modular & Extensible Result Pattern Library for .NET

</div>


✨ Overview

ResultKit is a lightweight, strongly-typed, and extensible result abstraction for .NET projects. It enables safe, explicit handling of operation outcomes—success, failure, validation errors, and exceptions—while improving API and service design.


📦 Packages

Package Description
ResultKit Core result, error, validation abstractions

🛠️ Installation

Install-Package ResultKit

🚀 Getting Started

using ResultKit;

// Simple success/failure
var ok = Result.Success();
var fail = Result.Failure(new Error(ErrorCodes.Validation, "Validation failed"));

// With validation errors
var validation = Result.ValidationFailure(new[] { new ValidationError("Field", "Message") });

// Strongly-typed generic result
var value = Result<string>.Success("foo");
Result<string> fromDto = "implicit"; // Implicit conversion

// Extension methods
var mapped = value.Map(s => s.ToUpper());

🧩 ASP.NET Core Integration

Result<T> can be turned into an API response with auto status code mapping:

[HttpGet("{id}")]
public ActionResult<Result<UserDto>> GetUser(int id)
{
    var dto = new UserDto { Id = id, Name = "Demo" };
    return Result<UserDto>.Success(dto).ToActionResult();
}
  • Ok for success
  • BadRequest for validation errors
  • NotFound for not found errors
  • Conflict, Unauthorized, etc.

🧪 Unit Testing

Easy to verify operation results and error handling:

[Fact]
public void ImplicitOperator_Wraps_Success()
{
    Result<string> result = "hi";
    Assert.True(result.IsSuccess);
    Assert.Equal("hi", result.Value);
}

To run all tests:

dotnet test tests/ResultKit.Tests

📁 Folder Structure

src/
├── ResultKit                  # Core result implementation
samples/
├── ResultKit.SampleApi        # Example WebAPI usage
├── ...
tests/
└── ResultKit.Tests            # Unit tests

🧱 Architecture

  • Result/Result<T>: success, error, validation error, exception
  • Error, ValidationError: standardized error contracts
  • Extension methods: Map, Bind, Match, ToActionResult
  • Immutable, functional, testable design

💡 Motivation

Tired of ambiguous error returns or magic strings? ResultKit brings:

  • 🔒 Type-safety for all result flows
  • 🔁 Cleaner APIs & predictable error handling
  • 🧪 Seamless testing
  • 🧩 Integration-ready for service & API layers

📜 License

MIT © Ataberk Kaya


📎 For detailed usage and API samples, see /samples and /tests folders


<div align="center"> Made with ❤️ by @taberkkaya </div>

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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.

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
9.0.2 157 6/4/2025
9.0.1 154 6/1/2025

Initial v9.0.1 public release. Typed Result, error/validation, extension methods, implicit support, WebAPI helper.