コード例 #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 (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Photos != null)
         {
             hashCode = hashCode * 59 + Photos.GetHashCode();
         }
         if (Gear != null)
         {
             hashCode = hashCode * 59 + Gear.GetHashCode();
         }
         if (Calories != null)
         {
             hashCode = hashCode * 59 + Calories.GetHashCode();
         }
         if (SegmentEfforts != null)
         {
             hashCode = hashCode * 59 + SegmentEfforts.GetHashCode();
         }
         if (DeviceName != null)
         {
             hashCode = hashCode * 59 + DeviceName.GetHashCode();
         }
         if (EmbedToken != null)
         {
             hashCode = hashCode * 59 + EmbedToken.GetHashCode();
         }
         if (SplitsMetric != null)
         {
             hashCode = hashCode * 59 + SplitsMetric.GetHashCode();
         }
         if (SplitsStandard != null)
         {
             hashCode = hashCode * 59 + SplitsStandard.GetHashCode();
         }
         if (Laps != null)
         {
             hashCode = hashCode * 59 + Laps.GetHashCode();
         }
         if (BestEfforts != null)
         {
             hashCode = hashCode * 59 + BestEfforts.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #2
0
        /// <summary>
        /// Returns true if DetailedActivity instances are equal
        /// </summary>
        /// <param name="other">Instance of DetailedActivity to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DetailedActivity other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                     ) &&
                 (
                     Photos == other.Photos ||
                     Photos != null &&
                     Photos.Equals(other.Photos)
                 ) &&
                 (
                     Gear == other.Gear ||
                     Gear != null &&
                     Gear.Equals(other.Gear)
                 ) &&
                 (
                     Calories == other.Calories ||
                     Calories != null &&
                     Calories.Equals(other.Calories)
                 ) &&
                 (
                     SegmentEfforts == other.SegmentEfforts ||
                     SegmentEfforts != null &&
                     SegmentEfforts.SequenceEqual(other.SegmentEfforts)
                 ) &&
                 (
                     DeviceName == other.DeviceName ||
                     DeviceName != null &&
                     DeviceName.Equals(other.DeviceName)
                 ) &&
                 (
                     EmbedToken == other.EmbedToken ||
                     EmbedToken != null &&
                     EmbedToken.Equals(other.EmbedToken)
                 ) &&
                 (
                     SplitsMetric == other.SplitsMetric ||
                     SplitsMetric != null &&
                     SplitsMetric.SequenceEqual(other.SplitsMetric)
                 ) &&
                 (
                     SplitsStandard == other.SplitsStandard ||
                     SplitsStandard != null &&
                     SplitsStandard.SequenceEqual(other.SplitsStandard)
                 ) &&
                 (
                     Laps == other.Laps ||
                     Laps != null &&
                     Laps.SequenceEqual(other.Laps)
                 ) &&
                 (
                     BestEfforts == other.BestEfforts ||
                     BestEfforts != null &&
                     BestEfforts.SequenceEqual(other.BestEfforts)
                 ));
        }