Exemple #1
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            var otherOrder = obj as Order;

            return(OrderID.CompareTo(otherOrder.OrderID));
        }
        public int CompareTo(OrderDetail other)
        {
            if (other == null)
            {
                return(1);
            }

            var comp1 = OrderID.CompareTo(other.OrderID);

            return(comp1 == 0
                ? ProductID.CompareTo(other.ProductID)
                : comp1);
        }
Exemple #3
0
 /// <summary>
 ///     Compares this instance to a specified Order and returns an indication
 ///     of their relative values.
 /// </summary>
 ///
 /// <param name="obj">
 ///      The Order to compare with this instance.
 /// </param>
 ///
 /// <returns>
 ///     A 32-bit signed integer that indicates whether this instance precedes, follows,
 ///     or appears in the same position in the sort order as the value parameter.Value
 ///     Condition Less than zero This instance precedes obj. Zero This instance has
 ///     the same position in the sort order as obj. Greater than zero This instance
 ///     follows obj.-or- obj is null.
 ///</returns>
 public int CompareTo(object obj)
 {
     return(OrderID.CompareTo(((Order)obj).OrderID));
 }