Exemplo n.º 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 (ClimbCategory != null)
         {
             hashCode = hashCode * 59 + ClimbCategory.GetHashCode();
         }
         if (ClimbCategoryDesc != null)
         {
             hashCode = hashCode * 59 + ClimbCategoryDesc.GetHashCode();
         }
         if (AvgGrade != null)
         {
             hashCode = hashCode * 59 + AvgGrade.GetHashCode();
         }
         if (StartLatlng != null)
         {
             hashCode = hashCode * 59 + StartLatlng.GetHashCode();
         }
         if (EndLatlng != null)
         {
             hashCode = hashCode * 59 + EndLatlng.GetHashCode();
         }
         if (ElevDifference != null)
         {
             hashCode = hashCode * 59 + ElevDifference.GetHashCode();
         }
         if (Distance != null)
         {
             hashCode = hashCode * 59 + Distance.GetHashCode();
         }
         if (Points != null)
         {
             hashCode = hashCode * 59 + Points.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Returns true if ExplorerSegment instances are equal
        /// </summary>
        /// <param name="other">Instance of ExplorerSegment to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ExplorerSegment 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)
                 ) &&
                 (
                     ClimbCategory == other.ClimbCategory ||
                     ClimbCategory != null &&
                     ClimbCategory.Equals(other.ClimbCategory)
                 ) &&
                 (
                     ClimbCategoryDesc == other.ClimbCategoryDesc ||
                     ClimbCategoryDesc != null &&
                     ClimbCategoryDesc.Equals(other.ClimbCategoryDesc)
                 ) &&
                 (
                     AvgGrade == other.AvgGrade ||
                     AvgGrade != null &&
                     AvgGrade.Equals(other.AvgGrade)
                 ) &&
                 (
                     StartLatlng == other.StartLatlng ||
                     StartLatlng != null &&
                     StartLatlng.Equals(other.StartLatlng)
                 ) &&
                 (
                     EndLatlng == other.EndLatlng ||
                     EndLatlng != null &&
                     EndLatlng.Equals(other.EndLatlng)
                 ) &&
                 (
                     ElevDifference == other.ElevDifference ||
                     ElevDifference != null &&
                     ElevDifference.Equals(other.ElevDifference)
                 ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     Points == other.Points ||
                     Points != null &&
                     Points.Equals(other.Points)
                 ));
        }