Example #1
0
 /// <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 (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (ActivityType != null)
         {
             hashCode = hashCode * 59 + ActivityType.GetHashCode();
         }
         if (Distance != null)
         {
             hashCode = hashCode * 59 + Distance.GetHashCode();
         }
         if (AverageGrade != null)
         {
             hashCode = hashCode * 59 + AverageGrade.GetHashCode();
         }
         if (MaximumGrade != null)
         {
             hashCode = hashCode * 59 + MaximumGrade.GetHashCode();
         }
         if (ElevationHigh != null)
         {
             hashCode = hashCode * 59 + ElevationHigh.GetHashCode();
         }
         if (ElevationLow != null)
         {
             hashCode = hashCode * 59 + ElevationLow.GetHashCode();
         }
         if (StartLatlng != null)
         {
             hashCode = hashCode * 59 + StartLatlng.GetHashCode();
         }
         if (EndLatlng != null)
         {
             hashCode = hashCode * 59 + EndLatlng.GetHashCode();
         }
         if (ClimbCategory != null)
         {
             hashCode = hashCode * 59 + ClimbCategory.GetHashCode();
         }
         if (City != null)
         {
             hashCode = hashCode * 59 + City.GetHashCode();
         }
         if (State != null)
         {
             hashCode = hashCode * 59 + State.GetHashCode();
         }
         if (Country != null)
         {
             hashCode = hashCode * 59 + Country.GetHashCode();
         }
         if (_Private != null)
         {
             hashCode = hashCode * 59 + _Private.GetHashCode();
         }
         if (AthletePrEffort != null)
         {
             hashCode = hashCode * 59 + AthletePrEffort.GetHashCode();
         }
         if (AthleteSegmentStats != null)
         {
             hashCode = hashCode * 59 + AthleteSegmentStats.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #2
0
        /// <summary>
        /// Returns true if SummarySegment instances are equal
        /// </summary>
        /// <param name="other">Instance of SummarySegment to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SummarySegment other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ActivityType == other.ActivityType ||
                     ActivityType != null &&
                     ActivityType.Equals(other.ActivityType)
                 ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     AverageGrade == other.AverageGrade ||
                     AverageGrade != null &&
                     AverageGrade.Equals(other.AverageGrade)
                 ) &&
                 (
                     MaximumGrade == other.MaximumGrade ||
                     MaximumGrade != null &&
                     MaximumGrade.Equals(other.MaximumGrade)
                 ) &&
                 (
                     ElevationHigh == other.ElevationHigh ||
                     ElevationHigh != null &&
                     ElevationHigh.Equals(other.ElevationHigh)
                 ) &&
                 (
                     ElevationLow == other.ElevationLow ||
                     ElevationLow != null &&
                     ElevationLow.Equals(other.ElevationLow)
                 ) &&
                 (
                     StartLatlng == other.StartLatlng ||
                     StartLatlng != null &&
                     StartLatlng.Equals(other.StartLatlng)
                 ) &&
                 (
                     EndLatlng == other.EndLatlng ||
                     EndLatlng != null &&
                     EndLatlng.Equals(other.EndLatlng)
                 ) &&
                 (
                     ClimbCategory == other.ClimbCategory ||
                     ClimbCategory != null &&
                     ClimbCategory.Equals(other.ClimbCategory)
                 ) &&
                 (
                     City == other.City ||
                     City != null &&
                     City.Equals(other.City)
                 ) &&
                 (
                     State == other.State ||
                     State != null &&
                     State.Equals(other.State)
                 ) &&
                 (
                     Country == other.Country ||
                     Country != null &&
                     Country.Equals(other.Country)
                 ) &&
                 (
                     _Private == other._Private ||
                     _Private != null &&
                     _Private.Equals(other._Private)
                 ) &&
                 (
                     AthletePrEffort == other.AthletePrEffort ||
                     AthletePrEffort != null &&
                     AthletePrEffort.Equals(other.AthletePrEffort)
                 ) &&
                 (
                     AthleteSegmentStats == other.AthleteSegmentStats ||
                     AthleteSegmentStats != null &&
                     AthleteSegmentStats.Equals(other.AthleteSegmentStats)
                 ));
        }