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.
C#
Assert(Ok(42).UnwrapOr(7) == 42);
Assert(Err<int>("error-message").UnwrapOr(7) == 7);

Definition

Namespace: Orx.Fun.Result
Assembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
C#
public T UnwrapOr(
	T fallbackValue
)

Parameters

fallbackValue  T
Fallback value that will be returned if the result is Err.

Return Value

T

See Also