ResTDo Method

Runs action(Unwrap()) only if IsOk; and returns itself back.
C#
// the logging call will only be made if the result of TryGetUser is Ok of a user.
// Since Do returns back the result, it can still be assigned to var 'user'.
Res<User> user = TryGetUser().Do(u => Log.Info($"User '{u.Name}' grabbed"));

Definition

Namespace: Orx.Fun.Result
Assembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
C#
public Res<T> Do(
	Action<T> action
)

Parameters

action  ActionT
Action that will be called with the underlying value when Ok.

Return Value

ResT

See Also