OptTAnd Method

Overload List

AndT2(FuncOptT2) Combines two options: this and lazyOther as follows:
  • returns Some of a tuple of both values if both options are Some;
  • returns None otherwise.
lazyOther is computed only if this is Some.
AndT2(OptT2) Combines two options: this and other as follows:
  • returns Some of a tuple of both values if both options are Some;
  • returns None otherwise.
C#
var combined = Some(12).And(Some(true));
Assert.Equal(Some((12, true)), combined);

combined = Some(12).And(None<bool>());
Assert.True(combined.IsNone);

combined = None<int>().And(Some(true));
Assert.True(combined.IsNone);

combined = None<int>().And(None<bool>());
Assert.True(combined.IsNone);

See Also