OptTAndT2(OptT2) Method

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);

Definition

Namespace: Orx.Fun.Option
Assembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
C#
public Opt<(T , T2 )> And<T2>(
	Opt<T2> other
)

Parameters

other  OptT2
Other option to combine with.

Type Parameters

T2

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

Return Value

OptValueTupleT, T2

See Also