ResTUnwrapOr(T) Method
Returns the underlying value when
IsOk; or returns the
fallbackValue when
IsErr.
This is a safe way to unwrap the result, by explicitly handling the Err variant.
Use the lazy
UnwrapOr(FuncT) variant if the computation of the fallback value is expensive.
Assert(Ok(42).UnwrapOr(7) == 42);
Assert(Err<int>("error-message").UnwrapOr(7) == 7);
Namespace: Orx.Fun.ResultAssembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
public T UnwrapOr(
T fallbackValue
)
- fallbackValue T
- Fallback value that will be returned if the result is Err.
T