PlainOutcomes 1.0.0

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

PlainOutcomes

PlainOutcomes is a minimal library that provides explicit Outcome and OutcomeError value types for .NET.

It is designed for scenarios where success and failure should be explicit, predictable, and represented as values instead of exceptions.


Why PlainOutcomes

This library intentionally avoids overengineering and hidden magic.

PlainOutcomes focuses on:

  • Explicit success / failure flow
  • Immutable value objects
  • No exceptions for expected failures
  • No framework, HTTP, or infrastructure coupling
  • Zero unnecessary allocations
  • Simple and predictable APIs

If you are looking for a full functional framework, this library is not that. If you want a small, explicit building block, this might fit.


Core Types

Outcome<T>

Represents the result of an operation that can either succeed with a value or fail with an error.

Characteristics:

  • Immutable
  • Value type (readonly record struct)
  • No identity
  • No side effects
  • Designed for frequent creation and disposal

OutcomeError

Represents an expected failure as part of the operation contract.

Characteristics:

  • Immutable value object
  • Stable error code
  • Human-readable message
  • Not an exception

Example

using PlainOutcomes;

var result = Outcome<User>.Failure(
    new OutcomeError("user_not_found", "User was not found")
);

if (result.TryGetError(out var error))
{
    Console.WriteLine(error.Code);    // user_not_found
    Console.WriteLine(error.Message); // User was not found
}

Or for a success case:

var result = Outcome<User>.Success(user);

if (result.TryGetValue(out var value))
{
    Console.WriteLine(value.Name);
}

Design Principles

  • Errors are values, not exceptions
  • Exceptions are reserved for unexpected or unrecoverable failures.
  • No implicit behavior
  • Consumers must explicitly check success or failure.
  • Minimal surface area
  • Only what is necessary to represent the outcome.
  • Fail fast on misuse
  • Invalid access patterns are detected immediately.

What PlainOutcomes Is Not

  • Not a functional programming framework
  • Not a validation library
  • Not an HTTP result abstraction
  • Not a replacement for exceptions in all scenarios

When to Use

PlainOutcomes is a good fit for:

  • Application and domain layers -Use cases and services
  • Business logic where failures are expected
  • Codebases that prefer explicit control flow

When Not to Use

You may want something else if:

  • You rely heavily on exception-based flow
  • You want automatic error propagation or retries
  • You need advanced functional combinators
  • You expect rich error hierarchies
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.0.0 134 1/14/2026