ImanSoftware.Outcome
1.0.3
dotnet add package ImanSoftware.Outcome --version 1.0.3
NuGet\Install-Package ImanSoftware.Outcome -Version 1.0.3
<PackageReference Include="ImanSoftware.Outcome" Version="1.0.3" />
<PackageVersion Include="ImanSoftware.Outcome" Version="1.0.3" />
<PackageReference Include="ImanSoftware.Outcome" />
paket add ImanSoftware.Outcome --version 1.0.3
#r "nuget: ImanSoftware.Outcome, 1.0.3"
#:package ImanSoftware.Outcome@1.0.3
#addin nuget:?package=ImanSoftware.Outcome&version=1.0.3
#tool nuget:?package=ImanSoftware.Outcome&version=1.0.3
ImanSoftware.Outcome
Version: 1.0.0 | Last Updated: August 2026
A lightweight and extensible Result/Outcome implementation for .NET that helps you manage application flow without relying on exceptions.
ImanSoftware.Outcome provides a clean implementation of the Result Pattern, allowing methods to return success or failure states with meaningful error information instead of throwing exceptions for expected scenarios.
Installation
Install the package using the .NET CLI:
dotnet add package ImanSoftware.Outcome
Why Outcome?
Using exceptions for expected business scenarios often makes code harder to read, test, and maintain.
Instead of this:
try
{
var product = service.Get(id);
}
catch (NotFoundException)
{
// Handle error
}
You can write:
var result = service.Get(id);
if (!result.IsSuccess)
{
// Handle error
}
This approach provides:
- Better readability
- Explicit success/failure flow
- Easier testing
- Better performance by avoiding unnecessary exceptions
- Consistent error handling across projects
Features
- ✅
OutcomeandOutcome<T>types - ✅ Success and Failure states
- ✅ Rich
OutcomeErrorobject - ✅ Predefined error types
- ✅ Implicit conversion from
TtoOutcome<T> - ✅ Common application exceptions
- ✅ Convert exceptions to
OutcomeusingToResult() - ✅ Lightweight and dependency-free
Outcome Types
Outcome
Represents an operation without a return value.
Outcome.Successful();
Outcome.Failure(
new OutcomeError(
"Something went wrong",
"GENERAL_ERROR",
OutcomeErrorType.Failure));
Outcome<T>
Represents an operation that returns data.
Outcome<Product>.Successful(product);
or simply:
Product product = GetProduct();
Outcome<Product> result = product;
OutcomeError
Each failure contains an OutcomeError.
new OutcomeError(
message: "Product not found",
code: "NOT_FOUND",
type: OutcomeErrorType.NotFound);
Properties:
| Property | Description |
|---|---|
| Message | Human-readable error message |
| Code | Application-specific error code |
| Type | Error category |
Error Types
The package includes predefined error categories:
| Type | Description |
|---|---|
| None | No error |
| Failure | General failure |
| Validation | Validation error |
| Problem | Unexpected problem |
| NotFound | Resource not found |
| Conflict | Conflict with current state |
| InquiryError | Business inquiry error |
Built-in Exceptions
The package includes common exceptions used in business applications.
NotFoundExceptionValidationExceptionBusinessRuleExceptionUnauthorizedExceptionForbiddenExceptionConflictExceptionBadRequestException
These exceptions can easily be converted into an Outcome.
Exception to Outcome
try
{
// code
}
catch (Exception ex)
{
return ex.ToResult();
}
Example
using ImanSoftware.Outcome;
public Outcome<Product> GetProduct(int id)
{
var product = _repository.GetById(id);
if (product is null)
{
return Outcome<Product>.Failure(
new OutcomeError(
"Product not found",
"NOT_FOUND",
OutcomeErrorType.NotFound));
}
return Outcome<Product>.Successful(product);
}
Working with Results
var result = GetProduct(id);
if (result.IsSuccess)
{
Console.WriteLine(result.Value.Name);
}
else
{
Console.WriteLine(result.Error.Message);
}
Design Goals
- Simple API
- High performance
- Minimal allocations
- Framework independent
- Easy integration with ASP.NET Core
- Suitable for Clean Architecture
- Suitable for DDD
- Suitable for CQRS
- Consistent error handling
Requirements
- .NET Standard 2.0+
- .NET 6+
- .NET 7+
- .NET 8+
- .NET 9+
- .NET 10.0+
Author
Iman Estiri
📧 contact.imanestiri@gmail.com
📧 dev.imanestiri@gmail.com
GitHub:
License
This project is licensed under the MIT License.
| Product | Versions 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. |
-
net10.0
- No dependencies.
NuGet packages (6)
Showing the top 5 NuGet packages that depend on ImanSoftware.Outcome:
| Package | Downloads |
|---|---|
|
ImanSoftware.Domain
Base DDD building blocks: Entity, ValueObject, AggregateRoot, Guard clauses, and domain event abstractions. |
|
|
ImanSoftware.RateLimiter
Rate limiting abstraction with in-memory and distributed support. |
|
|
ImanSoftware.Framework
Umbrella package that bundles all ImanSoftware modules for a unified development experience. |
|
|
ImanSoftware.DataAccess.Dapper
Dapper implementation of ImanSoftware.DataAccess for high-performance SQL operations. |
|
|
ImanSoftware.DataAccess
Database-agnostic data access abstractions (connection factory, transaction scope, query executor). |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.3 | 293 | 8/3/2026 |