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
                    
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="Xylocopadream.EasyResu" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xylocopadream.EasyResu" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Xylocopadream.EasyResu" />
                    
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 Xylocopadream.EasyResu --version 0.1.0
                    
#r "nuget: Xylocopadream.EasyResu, 0.1.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 Xylocopadream.EasyResu@0.1.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=Xylocopadream.EasyResu&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Xylocopadream.EasyResu&version=0.1.0
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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