Class ResultExtensions
- Namespace
- Badeend.Results.Extensions
- Assembly
- Badeend.Result.dll
Extension methods for Results.
public static class ResultExtensions
- Inheritance
-
ResultExtensions
- Inherited Members
Methods
AsBasicResult<TValue>(Result<TValue, Error>)
Change the signature from a generic result into a basic result.
[Pure]
public static Result<TValue> AsBasicResult<TValue>(this Result<TValue, Error> result)
Parameters
Returns
- Result<TValue>
Type Parameters
TValue
Remarks
This is an O(1)
operation and does not allocate any memory.
Typically there's no need to manually call this method because the operation also exists as an implicit conversion operator on the Result<TValue> type. However, sometimes C#'s type inference gets confused and needs a little help. In those cases, you can use this method to explicitly convert from one type to the other.
Additional overloads of this method exist for specific error types:
AsGenericResult<TValue>(Result<TValue>)
Change the signature from a basic result into a generic result.
[Pure]
public static Result<TValue, Error> AsGenericResult<TValue>(this Result<TValue> result)
Parameters
result
Result<TValue>
Returns
Type Parameters
TValue
Remarks
This is an O(1)
operation and does not allocate any memory.
Typically there's no need to manually call this method because the operation also exists as an implicit conversion operator on the Result<TValue> type. However, sometimes C#'s type inference gets confused and needs a little help. In those cases, you can use this method to explicitly convert from one type to the other.