BYSResults 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package BYSResults --version 1.0.0
                    
NuGet\Install-Package BYSResults -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="BYSResults" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BYSResults" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="BYSResults" />
                    
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 BYSResults --version 1.0.0
                    
#r "nuget: BYSResults, 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 BYSResults@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=BYSResults&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=BYSResults&version=1.0.0
                    
Install as a Cake Tool

BYSResults

NuGet version
Build Status
Coverage Status
License

Lightweight result types for explicit success/failure handling in .NET applications.


Table of Contents

  1. Features
  2. Installation
  3. Quick Start / Usage Examples
  4. API Reference
  5. Advanced Usage
  6. Contributing
  7. License
  8. Authors & Acknowledgments
  9. Links

Features

  • No exceptions for control flow – all outcomes are explicit
  • Fluent chaining via Bind, Map, etc.
  • Easy combination with Result.Combine(...)
  • Error aggregation and inspection (.Errors, .FirstError)
  • Generic and non-generic variants (Result vs. Result<T>)

Installation

Install via .NET CLI:

dotnet add package BYSResults
Or via Package Manager Console:

powershell
Copy
Edit
Install-Package BYSResults
Quick Start / Usage Examples
csharp
Copy
Edit
using BYSResults;

// Simple success/failure without a value
var r1 = Result.Success();
var r2 = Result.Failure("E001", "Something went wrong");

if (r2.IsFailure)
{
    Console.WriteLine(r2.FirstError?.Message);
}

// Generic result with a value
var r3 = Result<int>.Success(42);
var r4 = Result<string>.Failure("Missing data");

if (r3.IsSuccess)
{
    Console.WriteLine($"Value is {r3.Value}");
}

// Inspect errors
foreach (var err in r4.Errors)
{
    Console.WriteLine(err);
}
API Reference
Result
Member	Description
bool IsSuccess	true if operation succeeded
bool IsFailure	true if operation failed
IReadOnlyList<Error> Errors	List of all errors (empty if success)
Error? FirstError	Shortcut to the first error, or null
static Result Success()	Create a successful Result
static Result Failure(...)	Create a failure Result (overloads: Error, IEnumerable<Error>, string, (code, message))
static Result Combine(...)	Combine multiple Result instances into one, aggregating errors
Result AddError(Error)	Add an error to an existing Result
Result AddErrors(...)	Add multiple errors to an existing Result

Result<T>
Member	Description
T? Value	The value if successful (default if failure)
static Result<T> Success(T value)	Create a successful Result<T> with value
static Result<T> Failure(...)	Create a failure Result<T> (same overloads as Result)
static new Result<T> Combine(...)	Combine multiple Result instances; returns Result<T>
Result<TNext> Map(Func<T, TNext>)	Transform the value on success, propagate errors on failure
Result<TNext> Bind(Func<T, Result<TNext>>)	Chain operations that return Result<TNext>
Result<T> WithValue(T)	Set the .Value on an existing successful result
new Result<T> AddError(Error)	Add an error (returns Result<T> for chaining)
new Result<T> AddErrors(...)	Add multiple errors (returns Result<T>)

Error
Member	Description
string Code	Error code (optional)
string Message	Human-readable error message
override string ToString()	Returns "Code: Message" or just "Message"
Equality operators	==, != for value equality

Advanced Usage
csharp
Copy
Edit
// Combine several results
var c = Result.Combine(r1, r2, r3);
if (c.IsFailure)
{
    Console.WriteLine($"Combined failed: {string.Join(", ", c.Errors)}");
}

// Fluent chaining
var final = Result.Success()
    .Bind(_ => SomeOperation())       // returns Result<T>
    .Map(value => Process(value))    // returns Result<U>
    .AddError(new Error("X100", "Extra issue"));
Contributing
Fork the repository

Create a feature branch: git checkout -b feature/YourFeature

Commit your changes: git commit -m "Add awesome feature"

Push to the branch: git push origin feature/YourFeature

Open a Pull Request

Follow the code style and include tests

See CONTRIBUTING.md for more details.

License

Licensed under the MIT License. See LICENSE for details.

Authors & Acknowledgments
Your Name – @Thumper631

Thanks to all contributors

Links
NuGet: https://www.nuget.org/packages/BYSResults

Repository: https://github.com/Thumper631/BYSResults

Issues: https://github.com/Thumper631/BYSResults/issues

Documentation: https://Thumper631.github.io/BYSResults
Product 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 was computed.  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.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.3 316 11/3/2025
1.2.2 178 11/3/2025
1.2.1 120 10/31/2025
1.2.0 185 10/29/2025
1.1.5 292 9/30/2025
1.1.4 350 6/2/2025
1.1.3 177 6/1/2025
1.1.2 177 6/1/2025
1.1.1 164 6/1/2025
1.1.0 159 6/1/2025
1.0.0 362 5/8/2025

Initial release of BYSResults.