Beispiel #1
0
        /// <summary>
        /// Returns true if Order instances are equal
        /// </summary>
        /// <param name="other">Instance of Order to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Order other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                     ) &&
                 (
                     Shipaddress == other.Shipaddress ||
                     Shipaddress != null &&
                     Shipaddress.Equals(other.Shipaddress)
                 ) &&
                 (
                     Customer == other.Customer ||
                     Customer != null &&
                     Customer.Equals(other.Customer)
                 ));
        }
Beispiel #2
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 (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Shipaddress != null)
         {
             hashCode = hashCode * 59 + Shipaddress.GetHashCode();
         }
         if (Customer != null)
         {
             hashCode = hashCode * 59 + Customer.GetHashCode();
         }
         return(hashCode);
     }
 }