Ejemplo n.º 1
0
        /**********************************************************************/
        #region IComparable

        /// <summary>
        /// See <see cref="IComparable{T}.CompareTo(T)"/>
        /// </summary>
        public int CompareTo(MinMaxPair <T> pair)
        {
            var result = Comparer.Compare(Min, pair.Min);

            if (result == 0)
            {
                result = Comparer.Compare(Max, pair.Max);
            }

            return(result);
        }
Ejemplo n.º 2
0
        /**********************************************************************/
        #region IEquatable

        /// <summary>
        /// Checks if the current pair is equal to another.
        /// </summary>
        /// <param name="pair">The <see cref="MinMaxPair{T}"/> to compare against</param>
        /// <returns>True of the two pairs are equal; False otherwise.</returns>
        public bool Equals(MinMaxPair <T> pair) =>
        (Comparer.Compare(Min, pair.Min) == 0) &&
        (Comparer.Compare(Max, pair.Max) == 0);