Пример #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (OrderSummary != null)
         {
             hashCode = hashCode * 59 + OrderSummary.GetHashCode();
         }
         if (Membership != null)
         {
             hashCode = hashCode * 59 + Membership.GetHashCode();
         }
         if (LineItems != null)
         {
             hashCode = hashCode * 59 + LineItems.GetHashCode();
         }
         if (Addresses != null)
         {
             hashCode = hashCode * 59 + Addresses.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #2
0
        /// <summary>
        /// Returns true if PartnerOrder instances are equal
        /// </summary>
        /// <param name="other">Instance of PartnerOrder to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PartnerOrder other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     OrderSummary == other.OrderSummary ||
                     OrderSummary != null &&
                     OrderSummary.Equals(other.OrderSummary)
                     ) &&
                 (
                     Membership == other.Membership ||
                     Membership != null &&
                     Membership.Equals(other.Membership)
                 ) &&
                 (
                     LineItems == other.LineItems ||
                     LineItems != null &&
                     LineItems.SequenceEqual(other.LineItems)
                 ) &&
                 (
                     Addresses == other.Addresses ||
                     Addresses != null &&
                     Addresses.SequenceEqual(other.Addresses)
                 ));
        }