EitherOr<Ta, Tb>

References
public readonly struct EitherOr<Ta, Tb>
A pair of values, only one of which is usually set.
Ta
Tb

Constructors

EitherOr

#
Create an instance containing both an A and a B value.
public EitherOr(
Ta
a,
Tb
b
)

EitherOr

#
Create an instance containing only an A value.
public EitherOr(
Ta
a
)

EitherOr

#
Create an instance containing only a B value.
public EitherOr(
Tb
b
)

Properties

A

#
The Ta value, or default(Ta) if unset.
public Ta A { get; }

B

#
The Tb value, or default(Tb) if unset.
public Tb B { get; }

HasA

#
Gets whether the A value has been set. Note that A may still be null or default.
public bool HasA { get; }

HasAny

#
Gets whether either A, or B or both have been set.
public bool HasAny { get; }

HasB

#
Gets whether the B value has been set. Note that B may still be null or default.
public bool HasB { get; }

HasNeither

#
Gets whether neither A nor B have been set.
public bool HasNeither { get; }

Methods

AddA

#
Add or overwrite the A value, do not modify the B value.
public EitherOr<Ta, Tb> AddA(
Ta
a
)

AddB

#
Add or overwrite the B value, do not modify the A value.
public EitherOr<Ta, Tb> AddB(
Tb
b
)

Equals

#
public override bool Equals(
obj
)
ValueType.Equals

GetHashCode

#
public override int GetHashCode()

WithA

#
Overwrite the A value, clear the B value.
public EitherOr<Ta, Tb> WithA(
Ta
a
)

WithB

#
Overwrite the A value, clear the B value.
public EitherOr<Ta, Tb> WithB(
Tb
b
)

Operators

OperationResultDescription
EitherOr<Ta, Tb>==EitherOr<Ta, Tb>bool
EitherOr<Ta, Tb>!=EitherOr<Ta, Tb>bool