ResOr(FuncRes) Method

(lazy version) Combines two results: this and other as follows:
  • returns this if this is Ok;
  • returns other otherwise.
C#
var or = Ok().Or(Ok());
Assert.True(or.IsOk);

or = Ok().Or(Err("error-message"));
Assert.True(or.IsOk);

or = Err("error-message").Or(Ok());
Assert.True(or.IsOk);

or = Err("error-message").Or(Err("second-error-message"));
Assert.True(or.IsErr);
Assert.Equal(Some("second-error-message"), or.ErrorMessage());

Definition

Namespace: Orx.Fun.Result
Assembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
C#
public Res Or(
	Func<Res> other
)

Parameters

other  FuncRes
Other result to combine with.

Return Value

Res

See Also