ResTAnd(FuncRes) Method

Combines two results: this and other as follows:
  • returns this if both are Ok;
  • returns the error if one of the results is an Err;
  • returns the combined error if both results are Err.
C#
var combined = Ok(12).And(Ok());
Assert.Equal(Ok(12), combined);

combined = Ok(12).And(Err("failure"));
Assert.True(combined.IsErr);

combined = Err<int>("error").And(Ok());
Assert.True(combined.IsErr);

combined = Err<int>("error").And(Err("failure"));
Assert.True(combined.IsErr);

Definition

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

Parameters

lazyOther  FuncRes
Other result to combine with; lazily evaluated only if this is Ok.

Return Value

ResT

See Also