/// <summary> /// Returns true if CommonSimpleAddress instances are equal /// </summary> /// <param name="other">Instance of CommonSimpleAddress to be compared</param> /// <returns>Boolean</returns> public bool Equals(CommonSimpleAddress other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( MailingName == other.MailingName || MailingName != null && MailingName.Equals(other.MailingName) ) && ( AddressLine1 == other.AddressLine1 || AddressLine1 != null && AddressLine1.Equals(other.AddressLine1) ) && ( AddressLine2 == other.AddressLine2 || AddressLine2 != null && AddressLine2.Equals(other.AddressLine2) ) && ( AddressLine3 == other.AddressLine3 || AddressLine3 != null && AddressLine3.Equals(other.AddressLine3) ) && ( Postcode == other.Postcode || Postcode != null && Postcode.Equals(other.Postcode) ) && ( City == other.City || City != null && City.Equals(other.City) ) && ( State == other.State || State != null && State.Equals(other.State) ) && ( Country == other.Country || Country != null && Country.Equals(other.Country) )); }
/// <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 (MailingName != null) { hashCode = hashCode * 59 + MailingName.GetHashCode(); } if (AddressLine1 != null) { hashCode = hashCode * 59 + AddressLine1.GetHashCode(); } if (AddressLine2 != null) { hashCode = hashCode * 59 + AddressLine2.GetHashCode(); } if (AddressLine3 != null) { hashCode = hashCode * 59 + AddressLine3.GetHashCode(); } if (Postcode != null) { hashCode = hashCode * 59 + Postcode.GetHashCode(); } if (City != null) { hashCode = hashCode * 59 + City.GetHashCode(); } if (State != null) { hashCode = hashCode * 59 + State.GetHashCode(); } if (Country != null) { hashCode = hashCode * 59 + Country.GetHashCode(); } return(hashCode); } }