/// <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 (CustomerId != null) { hashCode = hashCode * 59 + CustomerId.GetHashCode(); } if (CustomerCode != null) { hashCode = hashCode * 59 + CustomerCode.GetHashCode(); } if (CustomerName != null) { hashCode = hashCode * 59 + CustomerName.GetHashCode(); } if (Email != null) { hashCode = hashCode * 59 + Email.GetHashCode(); } if (CompanyName != null) { hashCode = hashCode * 59 + CompanyName.GetHashCode(); } if (CustomerGroupId != null) { hashCode = hashCode * 59 + CustomerGroupId.GetHashCode(); } hashCode = hashCode * 59 + DebitMoney.GetHashCode(); if (Address != null) { hashCode = hashCode * 59 + Address.GetHashCode(); } if (PhoneNumber != null) { hashCode = hashCode * 59 + PhoneNumber.GetHashCode(); } if (DateOfBirth != null) { hashCode = hashCode * 59 + DateOfBirth.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if Customer instances are equal /// </summary> /// <param name="other">Instance of Customer to be compared</param> /// <returns>Boolean</returns> public bool Equals(Customer other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( CustomerId == other.CustomerId || CustomerId != null && CustomerId.Equals(other.CustomerId) ) && ( CustomerCode == other.CustomerCode || CustomerCode != null && CustomerCode.Equals(other.CustomerCode) ) && ( CustomerName == other.CustomerName || CustomerName != null && CustomerName.Equals(other.CustomerName) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( CompanyName == other.CompanyName || CompanyName != null && CompanyName.Equals(other.CompanyName) ) && ( CustomerGroupId == other.CustomerGroupId || CustomerGroupId != null && CustomerGroupId.Equals(other.CustomerGroupId) ) && ( DebitMoney == other.DebitMoney || DebitMoney.Equals(other.DebitMoney) ) && ( Address == other.Address || Address != null && Address.Equals(other.Address) ) && ( PhoneNumber == other.PhoneNumber || PhoneNumber != null && PhoneNumber.Equals(other.PhoneNumber) ) && ( DateOfBirth == other.DateOfBirth || DateOfBirth != null && DateOfBirth.Equals(other.DateOfBirth) )); }