LightResults - Operation Result Patterns for .NET
LightResults is an extremely light and modern .NET library that provides a simple and flexible implementation of the Result Pattern. The Result Pattern is a way of representing the outcome of an operation, whether it's successful or has encountered an error, in a more explicit and structured manner. This project is heavily inspired by Michael Altmann's excellent work with FluentResults.
References
This library targets .NET 8.0, .NET 9.0, and .NET 10.0 with no external runtime dependencies.
Installation
Install the library from NuGet:
dotnet add package LightResults
Dependencies
This library has no dependencies.
Advantages of this library
- ๐ชถ Lightweight โ Only contains what's necessary to implement the Result Pattern.
- โ๏ธ Extensible โ Simple interfaces and base classes make it easy to adapt.
- ๐งฑ Immutable โ Results and errors are immutable and cannot be changed after being created.
- ๐งต Thread-safe โ Error and metadata collections are read-only.
- โจ Modern โ Built against the latest version of .NET using the most recent best practices.
- ๐งช Native โ Written, compiled, and tested against the latest versions of .NET.
- โค๏ธ Compatible โ Multi-targeted for current LTS and STS releases.
- ๐ช Trimmable โ Compatible with ahead-of-time compilation (AOT) as of .NET 7.0.
- ๐ Performant โ Heavily optimized and benchmarked to aim for the highest possible performance.
Extensions
Several extensions are available to simplify implementation that use LightResults.