LightResults - Operation Result Patterns for .NET

Star Issue Sponsor

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.

main nuget downloads

References

This library targets .NET Standard 2.0, .NET 6.0, .NET 7.0, .NET 8.0, and .NET 9.0.

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 โ€” The Error list and Metadata dictionary use Immutable classes for thread-safety.
  • โœจ 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 โ€” Available for dozens of versions of .NET as a .NET Standard 2.0 library.
  • ๐Ÿชš 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.