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.
Assert(Some(42).UnwrapOr(7) == 42);
Assert(None<int>().UnwrapOr(7) == 7);
Namespace: Orx.Fun.OptionAssembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
public T UnwrapOr(
T fallbackValue
)
- fallbackValue T
- Fallback value that will be returned if the option is None.
T