ResTAndT2(ResT2) Method

Combines two results: this and other as follows:
  • returns Ok of a tuple of both values if both results 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(true));
Assert.Equal(Ok((12, true)), combined);

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

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

combined = Err<int>("error").And(Err<bool>("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 , T2 )> And<T2>(
	Res<T2> other
)

Parameters

other  ResT2
Other result to combine with.

Type Parameters

T2

[Missing <typeparam name="T2"/> documentation for "M:Orx.Fun.Result.Res`1.And``1(Orx.Fun.Result.Res{``0})"]

Return Value

ResValueTupleT, T2

See Also