/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { var hash = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hash = hash * 59 + Id.GetHashCode(); } if (EventType != null) { hash = hash * 59 + EventType.GetHashCode(); } if (CreatedAt != null) { hash = hash * 59 + CreatedAt.GetHashCode(); } if (Glucose != null) { hash = hash * 59 + Glucose.GetHashCode(); } if (GlucoseType != null) { hash = hash * 59 + GlucoseType.GetHashCode(); } if (Carbs != null) { hash = hash * 59 + Carbs.GetHashCode(); } if (Insulin != null) { hash = hash * 59 + Insulin.GetHashCode(); } if (Units != null) { hash = hash * 59 + Units.GetHashCode(); } if (Notes != null) { hash = hash * 59 + Notes.GetHashCode(); } if (EnteredBy != null) { hash = hash * 59 + EnteredBy.GetHashCode(); } return(hash); } }
/// <summary> /// Returns true if Treatment instances are equal /// </summary> /// <param name="other">Instance of Treatment to be compared</param> /// <returns>Boolean</returns> public bool Equals(Treatment other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( EventType == other.EventType || EventType != null && EventType.Equals(other.EventType) ) && ( CreatedAt == other.CreatedAt || CreatedAt != null && CreatedAt.Equals(other.CreatedAt) ) && ( Glucose == other.Glucose || Glucose != null && Glucose.Equals(other.Glucose) ) && ( GlucoseType == other.GlucoseType || GlucoseType != null && GlucoseType.Equals(other.GlucoseType) ) && ( Carbs == other.Carbs || Carbs != null && Carbs.Equals(other.Carbs) ) && ( Insulin == other.Insulin || Insulin != null && Insulin.Equals(other.Insulin) ) && ( Units == other.Units || Units != null && Units.Equals(other.Units) ) && ( Notes == other.Notes || Notes != null && Notes.Equals(other.Notes) ) && ( EnteredBy == other.EnteredBy || EnteredBy != null && EnteredBy.Equals(other.EnteredBy) )); }