Exemplo n.º 1
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
        /// </returns>
        public int CompareTo(ComparableSingleValue <T1, T2> other)
        {
            if (other == null)
            {
                return(-1);
            }
            else if (other.HasValue1)
            {
                if (this.HasValue1)
                {
                    return(this.Value1.CompareTo(other.Value1));
                }
            }
            else if (other.HasValue2)
            {
                if (this.HasValue2)
                {
                    return(this.Value2.CompareTo(other.Value2));
                }
            }
            else if (!other.HasValue && !this.HasValue)
            {
                return(0);
            }

            return(0);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
        /// </returns>
        public bool Equals(ComparableSingleValue <T1, T2> other)
        {
            if (other == null)
            {
                return(false);
            }
            else if (other.HasValue1)
            {
                if (this.HasValue1)
                {
                    return(this.Value1.Equals(other.Value1));
                }
            }
            else if (other.HasValue2)
            {
                if (this.HasValue2)
                {
                    return(this.Value2.Equals(other.Value2));
                }
            }
            else if (!other.HasValue && !this.HasValue)
            {
                return(true);
            }

            return(false);
        }