OptTUnwrapOr(T) Method

Returns the underlying value when IsSome; or returns the fallbackValue when IsNone. This is a safe way to unwrap the optional, by explicitly handling the None variant. Use the lazy UnwrapOr(FuncT) variant if the computation of the fallback value is expensive.
C#
Assert(Some(42).UnwrapOr(7) == 42);
Assert(None<int>().UnwrapOr(7) == 7);

Definition

Namespace: Orx.Fun.Option
Assembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
C#
public T UnwrapOr(
	T fallbackValue
)

Parameters

fallbackValue  T
Fallback value that will be returned if the option is None.

Return Value

T

See Also