Пример #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 (AmountOfMoney != null)
         {
             hashCode = hashCode * 59 + AmountOfMoney.GetHashCode();
         }
         if (InvoiceData != null)
         {
             hashCode = hashCode * 59 + InvoiceData.GetHashCode();
         }
         if (Level3InterchangeInformation != null)
         {
             hashCode = hashCode * 59 + Level3InterchangeInformation.GetHashCode();
         }
         if (OrderLineDetails != null)
         {
             hashCode = hashCode * 59 + OrderLineDetails.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #2
0
        /// <summary>
        /// Returns true if LineItem instances are equal
        /// </summary>
        /// <param name="other">Instance of LineItem to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(LineItem other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AmountOfMoney == other.AmountOfMoney ||
                     AmountOfMoney != null &&
                     AmountOfMoney.Equals(other.AmountOfMoney)
                     ) &&
                 (
                     InvoiceData == other.InvoiceData ||
                     InvoiceData != null &&
                     InvoiceData.Equals(other.InvoiceData)
                 ) &&
                 (
                     Level3InterchangeInformation == other.Level3InterchangeInformation ||
                     Level3InterchangeInformation != null &&
                     Level3InterchangeInformation.Equals(other.Level3InterchangeInformation)
                 ) &&
                 (
                     OrderLineDetails == other.OrderLineDetails ||
                     OrderLineDetails != null &&
                     OrderLineDetails.Equals(other.OrderLineDetails)
                 ));
        }