MisterMoret.Results
1.0.0-beta.5
dotnet add package MisterMoret.Results --version 1.0.0-beta.5
NuGet\Install-Package MisterMoret.Results -Version 1.0.0-beta.5
<PackageReference Include="MisterMoret.Results" Version="1.0.0-beta.5" />
<PackageVersion Include="MisterMoret.Results" Version="1.0.0-beta.5" />
<PackageReference Include="MisterMoret.Results" />
paket add MisterMoret.Results --version 1.0.0-beta.5
#r "nuget: MisterMoret.Results, 1.0.0-beta.5"
#:package MisterMoret.Results@1.0.0-beta.5
#addin nuget:?package=MisterMoret.Results&version=1.0.0-beta.5&prerelease
#tool nuget:?package=MisterMoret.Results&version=1.0.0-beta.5&prerelease
MisterMoret.Results
A lightweight implementation of the Result pattern for .NET applications, providing a robust way to handle operation outcomes without relying on exceptions for flow control.
This package is currently in beta and available via NuGet.org.
✨ Features
- Generic
Result<T>: Wrap operation outcomes with data and error information. - Web API Specialized:
HttpResultincludes HTTP status codes for seamless API integration. - Clean Flow Control: Avoid "exception-driven development" by using success/failure states.
- Error Collection: Collect and report multiple errors from a single operation.
- Modern .NET Support: Targets .NET 8.0, 9.0, and 10.0.
🚀 Installation
Install the package via the NuGet CLI:
dotnet add package MisterMoret.Results --version 1.0.0-beta.5
💡 Usage
Simple Result
using MisterMoret.Results;
public Result<string> GetGreeting(string name)
{
if (string.IsNullOrEmpty(name))
{
return Result<string>.Failure("Name cannot be empty.");
}
return Result<string>.Success($"Hello, {name}!");
}
// Consuming
var result = GetGreeting("Frédéric");
if (result.IsSuccess)
{
Console.WriteLine(result.Value);
}
else
{
foreach (var error in result.Errors)
{
Console.WriteLine($"Error: {error}");
}
}
HttpResult
Perfect for Web API controllers where the status code needs to be explicitly set.
using System.Net;
using MisterMoret.Results;
public HttpResult UpdateUser(int id, User user)
{
if (id <= 0)
{
return HttpResult.Failure("Invalid ID", HttpStatusCode.BadRequest);
}
// ... logic ...
return HttpResult.Success(HttpStatusCode.NoContent);
}
⚖️ License
This project is licensed under the MIT License - see the LICENSE file for details.
👤 Author
Frédéric Goetinck-Moret
| Product | Versions 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 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 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.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on MisterMoret.Results:
| Package | Downloads |
|---|---|
|
MisterMoret.Http
A simple and extensible API client wrapper for .NET applications. |
|
|
MisterMoret.Try
A lightweight try/catch wrapper that converts unhandled exceptions into failed Result or HttpResult objects, eliminating boilerplate exception handling in .NET applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-beta.5 | 107 | 5/25/2026 |
See the full changelog at https://github.com/fgoetinck/mister-moret/blob/main/src/MisterMoret.Results/CHANGELOG.md