OA.Result
1.0.0
dotnet add package OA.Result --version 1.0.0
NuGet\Install-Package OA.Result -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="OA.Result" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OA.Result" Version="1.0.0" />
<PackageReference Include="OA.Result" />
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 OA.Result --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: OA.Result, 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 OA.Result@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=OA.Result&version=1.0.0
#tool nuget:?package=OA.Result&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
OA.Result
A production-ready implementation of the Result pattern (Result and Result<T>) for .NET 9, designed for
domain-driven design (DDD) and building blocks. It supports error aggregation and functional programming helpers to
handle success/failure scenarios elegantly.
Features
- Result Types:
Resultfor void operations andResult<T>for typed results. - Error Aggregation: Collect multiple errors in a single result.
- Functional Helpers: Methods like
Map,Bind, andMatchfor chaining operations. - Immutable and Thread-Safe: Built for concurrent environments.
- NuGet Package: Easy to integrate into .NET 9 projects.
Installation
Install via NuGet:
dotnet add package OA.Result --version 1.0.0
using OA.Result;
// Success result
var success = Result.Success();
if (success.IsSuccess)
{
Console.WriteLine("Operation succeeded!");
}
// Failure result with error
var failure = Result.Failure("Something went wrong");
if (failure.IsFailure)
{
Console.WriteLine($"Error: {failure.Error}");
}
// Typed result
var result = Result<int>.Success(42);
var doubled = result.Map(x => x * 2); // Result<int> with 84
// Error aggregation
var errors = new List<string> { "Error 1", "Error 2" };
var aggregated = Result.Failure(errors);
// Bind for chaining
var chained = Result<int>.Success(10)
.Bind(x => x > 5 ? Result<int>.Success(x * 2) : Result<int>.Failure("Too small"));
// Match for pattern matching
var message = result.Match(
success: value => $"Success: {value}",
failure: error => $"Failure: {error}"
);
API Reference
Result.Success(): Creates a success result.
Result.Failure(string error): Creates a failure result with a single error.
Result.Failure(IEnumerable<string> errors): Creates a failure result with multiple errors.
Result<T>.Success(T value): Creates a success result with a value.
Result<T>.Failure(string error): Creates a failure result with an error.
Map(Func<T, TResult> mapper): Transforms the value if successful.
Bind(Func<T, Result<TResult>> binder): Chains operations.
Match(Func<T, TResult> success, Func<string, TResult> failure): Pattern matches on success/failure.
For full API docs, see the generated XML documentation file.
Contributing
Contributions are welcome! Please submit issues or pull requests on GitHub.
License
MIT License. See LICENSE for details.
| Product | Versions 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 OA.Result:
| Package | Downloads |
|---|---|
|
OA.Abstractions.CQRS
CQRS abstractions for .NET — lightweight interfaces for Commands, Queries, Handlers and pipeline behaviors. Designed to integrate with MediatR and Wolverine. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 184 | 12/30/2025 |