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