Atya.Foundation.Results 1.1.0

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

Atya.Foundation.Results

Result and Error primitives for expected, recoverable outcomes in Atya libraries.

NuGet Version Downloads .NET 10.0 License: MIT

Overview

Atya.Foundation.Results models expected failures as values. Use it for validation errors, not-found outcomes, conflicts, and upstream refusals where throwing exceptions would turn normal control flow into error handling.

The package is intentionally small and dependency-free: Error, ErrorKind, Result, and Result<T>.

Installation

dotnet add package Atya.Foundation.Results
Install-Package Atya.Foundation.Results
<PackageReference Include="Atya.Foundation.Results" Version="<latest-stable>" />

Quick Start

using Atya.Foundation.Results;

static Result<string> ValidateName(string? name)
{
    if (string.IsNullOrWhiteSpace(name))
    {
        return Result.Failure<string>(
            "atya.foundation.results.name-required",
            "A name is required.",
            ErrorKind.Validation);
    }

    return Result.Success(name);
}

var message = ValidateName("Atya").Match(
    value => $"Hello, {value}.",
    error => $"{error.Code}: {error.Message}");

The console sample compiles this same pattern: https://github.com/AtyaLibraries/Results/tree/development/samples/Results.Samples.Console

Feature Tour

Error

Error carries a stable code, a human-readable message, an ErrorKind, an optional Target, and child Details.

var error = new Error(
    "atya.foundation.results.not-found",
    "The requested item was not found.",
    ErrorKind.NotFound);

Use Target for the field, property, or resource the error applies to. Use Details for structured child errors, such as one child per validation failure.

var error = new Error(
    "atya.foundation.results.validation",
    "Validation failed.",
    target: null,
    details:
    [
        new Error(
            "atya.foundation.results.name-required",
            "A name is required.",
            target: "Name",
            kind: ErrorKind.Validation),
    ],
    kind: ErrorKind.Validation);

Details is never null; constructors copy the supplied child list. Error equality is structural: Code, Message, Kind, Target, and the ordered child Details all participate in equality and hash-code generation.

Result

Use Result when an operation has no success value.

Result outcome = Result.Success();
Result failed = Result.Failure("atya.foundation.results.conflict", "The item changed.", ErrorKind.Conflict);

Result<T>

Use Result<T> when an operation returns a value on success.

Result<int> parsed = Result.Success(42);
Result<string> text = parsed.Map(value => value.ToString(CultureInfo.InvariantCulture));

Match, Map, and Bind

Match converts both states to a single value. Map transforms only the success value. Bind chains another result-returning operation and propagates failures.

Result<int> loaded = Result.Success(42);

Result<string> formatted = loaded
    .Bind(value => value > 0
        ? Result.Success(value.ToString(CultureInfo.InvariantCulture))
        : Result.Failure<string>("atya.foundation.results.invalid", "Value must be positive.", ErrorKind.Validation));

Error Codes

Error codes should be stable, lowercase, and owned by the package or application concept that emits them. Atya packages use the shape atya.{area}.{name}.{error}.

This package documents these sample codes in tests and samples:

Code Meaning
atya.foundation.results.name-required Sample validation failure.
atya.foundation.results.failure Generic test failure.

Consumers should define their own domain-specific codes rather than reusing sample codes.

Dependencies

This package has no runtime dependencies.

Compatibility

Targets net10.0.

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 (6)

Showing the top 5 NuGet packages that depend on Atya.Foundation.Results:

Package Downloads
Atya.Errors.Validation

Validation primitives and error helpers for Atya error handling packages.

Atya.Errors.ProblemDetails

Problem Details helpers for ASP.NET Core Atya services.

Atya.Data.Pagination

ORM-agnostic paging primitives and paged result shapes for .NET services.

Atya.Application.Mediator

Source-generated, reflection-free mediator contracts and dispatch for .NET applications.

Atya.Application.Idempotency

Idempotency primitives for safely handling repeated application operations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 467 7/9/2026
1.0.0 164 7/9/2026