/// <summary> /// Returns true if Cert instances are equal /// </summary> /// <param name="other">Instance of Cert to be compared</param> /// <returns>Boolean</returns> public bool Equals(Cert other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Status == other.Status || Status != null && Status.Equals(other.Status) ) && ( Certificates == other.Certificates || Certificates != null && Certificates.SequenceEqual(other.Certificates) ) && ( IssuerDN == other.IssuerDN || IssuerDN != null && IssuerDN.Equals(other.IssuerDN) ) && ( SerialNumber == other.SerialNumber || SerialNumber != null && SerialNumber.Equals(other.SerialNumber) ) && ( SubjectDN == other.SubjectDN || SubjectDN != null && SubjectDN.Equals(other.SubjectDN) ) && ( ValidFrom == other.ValidFrom || ValidFrom != null && ValidFrom.Equals(other.ValidFrom) ) && ( ValidTo == other.ValidTo || ValidTo != null && ValidTo.Equals(other.ValidTo) )); }
/// <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 (Status != null) { hashCode = hashCode * 59 + Status.GetHashCode(); } if (Certificates != null) { hashCode = hashCode * 59 + Certificates.GetHashCode(); } if (IssuerDN != null) { hashCode = hashCode * 59 + IssuerDN.GetHashCode(); } if (SerialNumber != null) { hashCode = hashCode * 59 + SerialNumber.GetHashCode(); } if (SubjectDN != null) { hashCode = hashCode * 59 + SubjectDN.GetHashCode(); } if (ValidFrom != null) { hashCode = hashCode * 59 + ValidFrom.GetHashCode(); } if (ValidTo != null) { hashCode = hashCode * 59 + ValidTo.GetHashCode(); } return(hashCode); } }