BbQ.Outcome 1.0.2

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

Outcome

Outcome is a modern C# functional result type inspired by ErrorOr.
It builds on the excellent foundation of ErrorOr by adding async workflows, LINQ query syntax, deconstruction, Source Link, and multi-targeting — making error-aware programming feel like a first-class citizen in modern .NET.

✨ Why Outcome?

ErrorOr pioneered the idea of replacing exceptions with a discriminated union of either a value or errors.
Outcome takes this idea further:

  • Structured errors: Rich Error record with Code, Description, and Severity.
  • Async composition: BindAsync, MapAsync, CombineAsync for natural async pipelines.
  • LINQ integration: Native Select/SelectMany support for sync + async queries.
  • Deconstruction: Tuple-style unpacking (isSuccess, value, errors) for ergonomic handling.
  • Friendly ToString: Human-readable logging like Success: 42 or Errors: [DIV_ZERO: Division by zero].
  • Multi-targeting: Works across netstandard2.0, net6.0, and net8.0.
  • Source Link enabled: Step directly into source when debugging NuGet packages.
  • Source generator support: Auto-generate Error<T> helper properties from enums with the [QbqOutcome] attribute.

🚀 Example

var query =
    from x in ParseAsync("10")
    from y in DivideAsync(x, 2)
    select y * 2;

var (ok, value, errors) = await query;

Console.WriteLine(ok
    ? $"Result: {value}"
    : $"Errors: {string.Join("; ", errors.Select(e => e.Description))}");

Output:

Result: 10

📦 Installation

dotnet add package BbQ.Outcome

🔧 Source Generator: Error Helper Properties

The [QbqOutcome] attribute enables automatic generation of Error<TCode> helper properties for enums. This eliminates boilerplate and keeps error definitions DRY.

Usage

Mark your error enum with [QbqOutcome]:

[QbqOutcome]
public enum ApiErrorCode
{
    /// <summary>
    /// The requested resource was not found.
    /// </summary>
    NotFound,

    /// <summary>
    /// The user does not have permission to access this resource.
    /// </summary>
    Unauthorized,

    /// <summary>
    /// An internal server error occurred.
    /// </summary>
    InternalError
}

The source generator automatically creates a static class ApiErrorCodeErrors with helper properties:

// Generated code (do not edit)
public static class ApiErrorCodeErrors
{
    public static Error<ApiErrorCode> NotFoundError =>
        new(
            ApiErrorCode.NotFound,
            "The requested resource was not found.",
            ErrorSeverity.Error
        );

    public static Error<ApiErrorCode> UnauthorizedError =>
        new(
            ApiErrorCode.Unauthorized,
            "The user does not have permission to access this resource.",
            ErrorSeverity.Error
        );

    public static Error<ApiErrorCode> InternalErrorError =>
        new(
            ApiErrorCode.InternalError,
            "An internal server error occurred.",
            ErrorSeverity.Error
        );
}

Benefits

  • Zero boilerplate: No manual Error<TCode> construction.
  • Documentation-driven: Descriptions are extracted from XML doc comments (<summary> tags).
  • Consistent naming: Property names follow the pattern {EnumMember}Error.
  • Type-safe: Full compile-time type checking with Error<YourEnumType>.

How It Works

  1. The generator scans for enums decorated with [QbqOutcome].
  2. For each enum member, it extracts the summary from XML documentation comments.
  3. It generates a static helper class with pre-constructed Error<T> properties.
  4. If no documentation is found, it falls back to the enum member name.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on BbQ.Outcome:

Package Downloads
BbQ.ChatWidgets

Framework-agnostic widgets for AI chat UIs, powered by Microsoft.Extensions.AI.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1 112 4/17/2026
1.1.0 107 4/16/2026
1.0.17 117 4/3/2026
1.0.16 274 3/12/2026
1.0.15 97 3/11/2026
1.0.14 94 3/6/2026
1.0.13 93 3/4/2026
1.0.12 114 1/27/2026
1.0.11 107 1/26/2026
1.0.10 770 11/28/2025
1.0.9 163 11/28/2025
1.0.8 198 11/27/2025
1.0.7 203 11/27/2025
1.0.6 200 11/26/2025
1.0.5 207 11/26/2025
1.0.4 203 11/26/2025
1.0.3 197 11/25/2025
1.0.2 204 11/23/2025
1.0.1 205 11/23/2025
1.0.0 210 11/23/2025