Пример #1
0
 public int CompareTo(Either <L, R> other)
 {
     return(isLeft ? (other.isLeft ? Smooth.Collections.Comparer <L> .Default.Compare(leftValue, other.leftValue) : -1) :
            other.isLeft ? 1 : Smooth.Collections.Comparer <R> .Default.Compare(rightValue, other.rightValue));
 }
Пример #2
0
 public bool Equals(Either <L, R> other)
 {
     return(isLeft ? other.isLeft && Smooth.Collections.EqualityComparer <L> .Default.Equals(leftValue, other.leftValue) :
            !other.isLeft && Smooth.Collections.EqualityComparer <R> .Default.Equals(rightValue, other.rightValue));
 }