Class EnumResultExtensions
- Namespace
- Badeend.Results.Extensions
- Assembly
- Badeend.Result.dll
Extensions for Result<T, TError> where TError : enum
.
public static class EnumResultExtensions
- Inheritance
-
EnumResultExtensions
- Inherited Members
Remarks
These extension methods have been split out from ResultExtensions because .NET does not support overloading methods based on generic constraints only.
Methods
AsBasicResult<TValue, TError>(Result<TValue, TError>)
Convert the result's error value into a new Error. If the result is successful, this method is a no-op.
[Pure]
public static Result<TValue> AsBasicResult<TValue, TError>(this Result<TValue, TError> result) where TError : struct, Enum
Parameters
result
Result<TValue, TError>
Returns
- Result<TValue>
Type Parameters
TValue
TError
Remarks
If the error value is a regular declared enum member (i.e. it is returned by Enum.GetValues
),
then this is an O(1)
operation and does not allocate any memory.