OALY2000.Results 1.0.0

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

Results

Installation

NuGet Version

Basic usage

The library defines implicit operators to convert from T to Result<T> and from Exception to Result<T>.

To simplify the usage of result pattern, LINQ syntax is available.

Result<int> number1 = 10;
Result<int> number2 = 0;
Result<int> invalideNumber = new Exception("Invalid number");

var result =
    from n1 in number1
    from n2 in number2
    from n3 in invalideNumber
    select n1 + n2 + n3;

if (result.IsSuccess)
{
    Console.WriteLine(result.Value);
}
else throw result.Error;

OpenApi/Swagger Integration

Returning Result<T> directly is Ok. But if you want to customize problem details, you can implement IFailedResultHandler and register it.

var api = app.MapGroup("/api");

api.MapGet("/success", () =>
{
    var forecast = Enumerable.Range(1, 5).Select(index =>
        new WeatherForecast
        (
            DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
            Random.Shared.Next(-20, 55),
            summaries[Random.Shared.Next(summaries.Length)]
        ))
        .ToArray();
    return Result<WeatherForecast[]>.Success(forecast);
});

api.MapGet("/failure", () =>
{
    return Result<WeatherForecast>.Fail(new Exception("Something went wrong"));
});
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 OALY2000.Results:

Package Downloads
OALY2000.TencentCloud

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 139 1/14/2026
1.0.0-preview.3 131 9/28/2025
1.0.0-preview.2 196 8/30/2025
1.0.0-preview.1 295 8/25/2025