Nomad.Common.Results 1.0.0

dotnet add package Nomad.Common.Results --version 1.0.0
                    
NuGet\Install-Package Nomad.Common.Results -Version 1.0.0
                    
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="Nomad.Common.Results" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nomad.Common.Results" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Nomad.Common.Results" />
                    
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 Nomad.Common.Results --version 1.0.0
                    
#r "nuget: Nomad.Common.Results, 1.0.0"
                    
#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 Nomad.Common.Results@1.0.0
                    
#: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=Nomad.Common.Results&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Nomad.Common.Results&version=1.0.0
                    
Install as a Cake Tool

Nomad.Common.Results

A clean, lightweight, and high-performance implementation of the Result pattern for .NET. Designed for domain and application layers where clarity, control, and correctness matter.


✨ Features

  • Result and Result<T> as readonly record struct — zero heap allocations
  • Clear distinction between success and failure states
  • Rich error modeling via Error type: Validation, NotFound, Conflict, Internal, etc.
  • Seamless implicit conversion support for primitives and errors
  • Optimized for functional-style flow and clear return semantics

📦 Installation

dotnet add package Nomad.Common.Results

🚀 Quick Usage

// Success
Result result = Result.Success();
Result<string> ok = "Done";

// Failure
Result fail = Error.Validation("Invalid data");
Result<Guid> notFound = Error.NotFound("Entity not found");

// Pattern check
if (result.Succeeded)
{
    Console.WriteLine("All good");
}
else
{
    Console.WriteLine(result.FailureReason?.Message);
}

💡 Use Cases

  • Application services and use cases
  • Domain services with predictable output
  • Clean validation and error propagation
  • Replacing exceptions in workflows
  • Consistent API responses in Minimal APIs

🧪 Testing Pattern

Result<string> user = GetUser();

if (user is { Succeeded: true, Value: var name })
{
    Console.WriteLine($"Hello {name}!");
}
else
{
    Console.WriteLine(user.FailureReason?.Message);
}

🧱 Design Notes

  • Error is a strongly typed record with built-in categories
  • All results are immutable
  • Works great with MinimalApi, UseCaseDispatcher, and CQRS

📄 License

MIT License · © Nomad

All feedback and contributions are welcome.

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.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Nomad.Common.Results:

Package Downloads
Nomad.Common.MinimalApi

Extensions and tools for ASP.NET Core Minimal APIs

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 202 4/14/2025