/// <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 (BiggestRideDistance != null) { hashCode = hashCode * 59 + BiggestRideDistance.GetHashCode(); } if (BiggestClimbElevationGain != null) { hashCode = hashCode * 59 + BiggestClimbElevationGain.GetHashCode(); } if (RecentRideTotals != null) { hashCode = hashCode * 59 + RecentRideTotals.GetHashCode(); } if (RecentRunTotals != null) { hashCode = hashCode * 59 + RecentRunTotals.GetHashCode(); } if (RecentSwimTotals != null) { hashCode = hashCode * 59 + RecentSwimTotals.GetHashCode(); } if (YtdRideTotals != null) { hashCode = hashCode * 59 + YtdRideTotals.GetHashCode(); } if (YtdRunTotals != null) { hashCode = hashCode * 59 + YtdRunTotals.GetHashCode(); } if (YtdSwimTotals != null) { hashCode = hashCode * 59 + YtdSwimTotals.GetHashCode(); } if (AllRideTotals != null) { hashCode = hashCode * 59 + AllRideTotals.GetHashCode(); } if (AllRunTotals != null) { hashCode = hashCode * 59 + AllRunTotals.GetHashCode(); } if (AllSwimTotals != null) { hashCode = hashCode * 59 + AllSwimTotals.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if ActivityStats instances are equal /// </summary> /// <param name="other">Instance of ActivityStats to be compared</param> /// <returns>Boolean</returns> public bool Equals(ActivityStats other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( BiggestRideDistance == other.BiggestRideDistance || BiggestRideDistance != null && BiggestRideDistance.Equals(other.BiggestRideDistance) ) && ( BiggestClimbElevationGain == other.BiggestClimbElevationGain || BiggestClimbElevationGain != null && BiggestClimbElevationGain.Equals(other.BiggestClimbElevationGain) ) && ( RecentRideTotals == other.RecentRideTotals || RecentRideTotals != null && RecentRideTotals.Equals(other.RecentRideTotals) ) && ( RecentRunTotals == other.RecentRunTotals || RecentRunTotals != null && RecentRunTotals.Equals(other.RecentRunTotals) ) && ( RecentSwimTotals == other.RecentSwimTotals || RecentSwimTotals != null && RecentSwimTotals.Equals(other.RecentSwimTotals) ) && ( YtdRideTotals == other.YtdRideTotals || YtdRideTotals != null && YtdRideTotals.Equals(other.YtdRideTotals) ) && ( YtdRunTotals == other.YtdRunTotals || YtdRunTotals != null && YtdRunTotals.Equals(other.YtdRunTotals) ) && ( YtdSwimTotals == other.YtdSwimTotals || YtdSwimTotals != null && YtdSwimTotals.Equals(other.YtdSwimTotals) ) && ( AllRideTotals == other.AllRideTotals || AllRideTotals != null && AllRideTotals.Equals(other.AllRideTotals) ) && ( AllRunTotals == other.AllRunTotals || AllRunTotals != null && AllRunTotals.Equals(other.AllRunTotals) ) && ( AllSwimTotals == other.AllSwimTotals || AllSwimTotals != null && AllSwimTotals.Equals(other.AllSwimTotals) )); }