/// <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 (ObservationType != null) { hashCode = hashCode * 59 + ObservationType.GetHashCode(); } if (ThingId != null) { hashCode = hashCode * 59 + ThingId.GetHashCode(); } if (StartTime != null) { hashCode = hashCode * 59 + StartTime.GetHashCode(); } if (EndTime != null) { hashCode = hashCode * 59 + EndTime.GetHashCode(); } return(hashCode); } }
public void GetHashCode_ThingId_EqualsIdStringHashCode() { const string driver = "Driver1"; const string gateway = "Gateway1"; const string thing = "Thing1"; var thingId = new ThingId(new GatewayId(driver, gateway), thing); Assert.Equal(thingId.ToString().GetHashCode(), thingId.GetHashCode()); }
/// <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 (PersonId != null) { hashCode = hashCode * 59 + PersonId.GetHashCode(); } if (ThingId != null) { hashCode = hashCode * 59 + ThingId.GetHashCode(); } if (Timestamp != null) { hashCode = hashCode * 59 + Timestamp.GetHashCode(); } return(hashCode); } }
/// <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 (ThingId != null) { hashCode = hashCode * 59 + ThingId.GetHashCode(); } if (DatastreamId != null) { hashCode = hashCode * 59 + DatastreamId.GetHashCode(); } if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Personid != null) { hashCode = hashCode * 59 + Personid.GetHashCode(); } if (Zoneid != null) { hashCode = hashCode * 59 + Zoneid.GetHashCode(); } if (PhenomenTime != null) { hashCode = hashCode * 59 + PhenomenTime.GetHashCode(); } if (ObservationResult != null) { hashCode = hashCode * 59 + ObservationResult.GetHashCode(); } return(hashCode); } }
/// <inheritdoc /> public override int GetHashCode() { return(ThingId.GetHashCode()); }