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