OptTMatchTOut(FuncT, TOut, TOut) Method

Maps into whenSome(Unwrap()) whenever IsSome; and into whenNone otherwise.
C#
Opt<User> user = GetOptionalUser(..);
string greeting = user.Match(u => $"Welcome back {u.Name}", "Hello");
greeting = user.Match(whenSome: u => $"Welcome back {u.Name}", whenNone: "Hello");

Definition

Namespace: Orx.Fun.Option
Assembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
C#
public TOut Match<TOut>(
	Func<T, TOut> whenSome,
	TOut whenNone
)

Parameters

whenSome  FuncT, TOut
Mapping function (T -> TOut) that will be called with Unwrapped value to get the return value when Some.
whenNone  TOut
Return value when None.

Type Parameters

TOut

[Missing <typeparam name="TOut"/> documentation for "M:Orx.Fun.Option.Opt`1.Match``1(System.Func{`0,``0},``0)"]

Return Value

TOut

See Also