/// <summary> /// Returns true if UserDetailsInfo instances are equal /// </summary> /// <param name="other">Instance of UserDetailsInfo to be compared</param> /// <returns>Boolean</returns> public bool Equals(UserDetailsInfo other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( FirstName == other.FirstName || FirstName != null && FirstName.Equals(other.FirstName) ) && ( LastName == other.LastName || LastName != null && LastName.Equals(other.LastName) ) && ( DateOfBirth == other.DateOfBirth || DateOfBirth != null && DateOfBirth.Equals(other.DateOfBirth) ) && ( PlaceOfBirth == other.PlaceOfBirth || PlaceOfBirth != null && PlaceOfBirth.Equals(other.PlaceOfBirth) ) && ( NationalIdNumber == other.NationalIdNumber || NationalIdNumber != null && NationalIdNumber.Equals(other.NationalIdNumber) ) && ( NationalIdType == other.NationalIdType || NationalIdType != null && NationalIdType.Equals(other.NationalIdType) ) && ( PrimaryCitizenshipId == other.PrimaryCitizenshipId || PrimaryCitizenshipId != null && PrimaryCitizenshipId.Equals(other.PrimaryCitizenshipId) ) && ( PrimaryAddressId == other.PrimaryAddressId || PrimaryAddressId != null && PrimaryAddressId.Equals(other.PrimaryAddressId) )); }
/// <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 (FirstName != null) { hashCode = hashCode * 59 + FirstName.GetHashCode(); } if (LastName != null) { hashCode = hashCode * 59 + LastName.GetHashCode(); } if (DateOfBirth != null) { hashCode = hashCode * 59 + DateOfBirth.GetHashCode(); } if (PlaceOfBirth != null) { hashCode = hashCode * 59 + PlaceOfBirth.GetHashCode(); } if (NationalIdNumber != null) { hashCode = hashCode * 59 + NationalIdNumber.GetHashCode(); } if (NationalIdType != null) { hashCode = hashCode * 59 + NationalIdType.GetHashCode(); } if (PrimaryCitizenshipId != null) { hashCode = hashCode * 59 + PrimaryCitizenshipId.GetHashCode(); } if (PrimaryAddressId != null) { hashCode = hashCode * 59 + PrimaryAddressId.GetHashCode(); } return(hashCode); } }