Skip to content
Youssef Sellami edited this page Dec 2, 2021 · 11 revisions

Result.Net

to get started using the library you can install it from the NuGet package manager Install-Package Result.Net

Result.Net is a library that exposes a Result object that allows you to encapsulate the execution status of an operation so that instead of throwing exceptions you return a result object that describes the status of the execution, this is a common pattern you may want to read this article "To Throw or To Return (Exceptions vs Result Object)?" for more details on when to use the Result Object pattern over exception and when not.

the library gives you three types of the Result objects:

  1. Result: this type is used to describe the execution status of a void method with no return value.
  2. Result<>: this type is a generic type that drives from Result, and is used to describe the execution status of a method with a return value.
  3. ListResult<>: same as Result<TData> but it used if the generic type is a list, so that instead of using Result<IEnumerable<float>> we use ListResult<float>, which is internal driving from Result<IReadOnlyCollection<TData>>.

Result Object Page:
check this page for more details on each Result object type.

helper methods page:
this page contains a detailed description of all methods that you can use to manipulate the Result Object.

Working with Exceptions:
On this page, you will learn how to combine exceptions with result objects.

Clone this wiki locally