/// <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 (TypeIdentityDocument != null) { hashCode = hashCode * 59 + TypeIdentityDocument.GetHashCode(); } if (DateOfIssue != null) { hashCode = hashCode * 59 + DateOfIssue.GetHashCode(); } if (SerialIdentityCard != null) { hashCode = hashCode * 59 + SerialIdentityCard.GetHashCode(); } if (NumberIedentityCard != null) { hashCode = hashCode * 59 + NumberIedentityCard.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if IdentityCard instances are equal /// </summary> /// <param name="other">Instance of IdentityCard to be compared</param> /// <returns>Boolean</returns> public bool Equals(IdentityCard other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( TypeIdentityDocument == other.TypeIdentityDocument || TypeIdentityDocument != null && TypeIdentityDocument.Equals(other.TypeIdentityDocument) ) && ( DateOfIssue == other.DateOfIssue || DateOfIssue != null && DateOfIssue.Equals(other.DateOfIssue) ) && ( SerialIdentityCard == other.SerialIdentityCard || SerialIdentityCard != null && SerialIdentityCard.Equals(other.SerialIdentityCard) ) && ( NumberIedentityCard == other.NumberIedentityCard || NumberIedentityCard != null && NumberIedentityCard.Equals(other.NumberIedentityCard) )); }