Xylocopadream.EasyResu
0.1.0
Prefix Reserved
dotnet add package Xylocopadream.EasyResu --version 0.1.0
NuGet\Install-Package Xylocopadream.EasyResu -Version 0.1.0
<PackageReference Include="Xylocopadream.EasyResu" Version="0.1.0" />
<PackageVersion Include="Xylocopadream.EasyResu" Version="0.1.0" />
<PackageReference Include="Xylocopadream.EasyResu" />
paket add Xylocopadream.EasyResu --version 0.1.0
#r "nuget: Xylocopadream.EasyResu, 0.1.0"
#:package Xylocopadream.EasyResu@0.1.0
#addin nuget:?package=Xylocopadream.EasyResu&version=0.1.0
#tool nuget:?package=Xylocopadream.EasyResu&version=0.1.0
Xylocopadream.EasyResu
Lightweight result types to return a success, warning or error status instead of throwing exceptions.
Resu: outcome without value.Resu<T>: outcome that may carry a value — a payload on success, or a detailed code (e.g. an enum) on warning/error.IResu: common read-only view to handle any outcome generically (logging, user notification).
Resu and Resu<T> are deliberately unrelated: a Resu<T> can never silently be passed where a Resu is expected.
Usage
using Xylocopadream.EasyResu;
Resu Save()
=> canSave ? Resu.Ok() : Resu.Error("Disk is full");
// Payload on success, no value on error
Resu<User> Load(int id)
=> repository.Find(id) is { } user ? Resu<User>.Ok(user) : Resu<User>.Error("Not found");
// Detailed code on warning/error: attach it explicitly with WarningWith / ErrorWith
Resu<LoginOutcome> Login()
=> offline
? Resu<LoginOutcome>.ErrorWith(LoginOutcome.NetworkError, "Server unreachable")
: Resu<LoginOutcome>.Ok(LoginOutcome.Success);
var result = Load(42);
if (result.TryGetValue(out var user)) // true only when a value was explicitly given
{
Console.WriteLine(user.Name);
}
else
{
Console.WriteLine(result.GetMessage);
}
A value is present only when given to Ok, WarningWith or ErrorWith: Error(...) on a Resu<SomeEnum> never exposes default(SomeEnum) as a value.
License
MIT
| 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 (1)
Showing the top 1 NuGet packages that depend on Xylocopadream.EasyResu:
| Package | Downloads |
|---|---|
|
Xylocopadream.Otp.Client
Client for the Xylocopadream OTP server: passwordless e-mail login, JWT storage and automatic token refresh. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 51 | 10/7/2026 |