Пример #1
0
        /// <summary>
        /// Returns true if DetailedSegment instances are equal
        /// </summary>
        /// <param name="other">Instance of DetailedSegment to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DetailedSegment other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CreatedAt == other.CreatedAt ||
                     CreatedAt != null &&
                     CreatedAt.Equals(other.CreatedAt)
                     ) &&
                 (
                     UpdatedAt == other.UpdatedAt ||
                     UpdatedAt != null &&
                     UpdatedAt.Equals(other.UpdatedAt)
                 ) &&
                 (
                     TotalElevationGain == other.TotalElevationGain ||
                     TotalElevationGain != null &&
                     TotalElevationGain.Equals(other.TotalElevationGain)
                 ) &&
                 (
                     Map == other.Map ||
                     Map != null &&
                     Map.Equals(other.Map)
                 ) &&
                 (
                     EffortCount == other.EffortCount ||
                     EffortCount != null &&
                     EffortCount.Equals(other.EffortCount)
                 ) &&
                 (
                     AthleteCount == other.AthleteCount ||
                     AthleteCount != null &&
                     AthleteCount.Equals(other.AthleteCount)
                 ) &&
                 (
                     Hazardous == other.Hazardous ||
                     Hazardous != null &&
                     Hazardous.Equals(other.Hazardous)
                 ) &&
                 (
                     StarCount == other.StarCount ||
                     StarCount != null &&
                     StarCount.Equals(other.StarCount)
                 ));
        }
Пример #2
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 (CreatedAt != null)
         {
             hashCode = hashCode * 59 + CreatedAt.GetHashCode();
         }
         if (UpdatedAt != null)
         {
             hashCode = hashCode * 59 + UpdatedAt.GetHashCode();
         }
         if (TotalElevationGain != null)
         {
             hashCode = hashCode * 59 + TotalElevationGain.GetHashCode();
         }
         if (Map != null)
         {
             hashCode = hashCode * 59 + Map.GetHashCode();
         }
         if (EffortCount != null)
         {
             hashCode = hashCode * 59 + EffortCount.GetHashCode();
         }
         if (AthleteCount != null)
         {
             hashCode = hashCode * 59 + AthleteCount.GetHashCode();
         }
         if (Hazardous != null)
         {
             hashCode = hashCode * 59 + Hazardous.GetHashCode();
         }
         if (StarCount != null)
         {
             hashCode = hashCode * 59 + StarCount.GetHashCode();
         }
         return(hashCode);
     }
 }