/// <summary> /// Returns less than 0 if this range's From is less than the other, greater than 0 if greater. /// If both are equal, the comparison of the To values is returned. /// 0 if both ranges are equal. /// </summary> /// <param name="x">The first item.</param> /// <param name="y">The other item.</param> /// <returns></returns> int IComparer <RangeValuePair <TKey, TValue> > .Compare(RangeValuePair <TKey, TValue> x, RangeValuePair <TKey, TValue> y) { var fromComp = comparer.Compare(x.From, y.From); if (fromComp == 0) { return(comparer.Compare(x.To, y.To)); } return(fromComp); }
public bool Equals(RangeValuePair <TKey, TValue> other) { return(EqualityComparer <TKey> .Default.Equals(From, other.From) && EqualityComparer <TKey> .Default.Equals(To, other.To) && EqualityComparer <TValue> .Default.Equals(Value, other.Value)); }