OptTDoIfNone Method

Runs actionOnNone() only if IsNone; and returns itself back. Counterpart of Do(ActionT) for the None variant.
C#
// the logging call will only be made if the result of GetOptionalUser is None.
// Since DoIfNone returns back the option, it can still be assigned to var 'user'.
Opt<User> user = GetOptionalUser().DoIfNone(() => Log.Warning("User could not be read"));

Definition

Namespace: Orx.Fun.Option
Assembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
C#
public Opt<T> DoIfNone(
	Action actionOnNone
)

Parameters

actionOnNone  Action
Action that will be called when None.

Return Value

OptT

See Also