コード例 #1
0
        /// <summary>
        /// Returns true if DetailedAthlete instances are equal
        /// </summary>
        /// <param name="other">Instance of DetailedAthlete to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DetailedAthlete other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FollowerCount == other.FollowerCount ||
                     FollowerCount != null &&
                     FollowerCount.Equals(other.FollowerCount)
                     ) &&
                 (
                     FriendCount == other.FriendCount ||
                     FriendCount != null &&
                     FriendCount.Equals(other.FriendCount)
                 ) &&
                 (
                     MeasurementPreference == other.MeasurementPreference ||
                     MeasurementPreference != null &&
                     MeasurementPreference.Equals(other.MeasurementPreference)
                 ) &&
                 (
                     Ftp == other.Ftp ||
                     Ftp != null &&
                     Ftp.Equals(other.Ftp)
                 ) &&
                 (
                     Weight == other.Weight ||
                     Weight != null &&
                     Weight.Equals(other.Weight)
                 ) &&
                 (
                     Clubs == other.Clubs ||
                     Clubs != null &&
                     Clubs.SequenceEqual(other.Clubs)
                 ) &&
                 (
                     Bikes == other.Bikes ||
                     Bikes != null &&
                     Bikes.SequenceEqual(other.Bikes)
                 ) &&
                 (
                     Shoes == other.Shoes ||
                     Shoes != null &&
                     Shoes.SequenceEqual(other.Shoes)
                 ));
        }
コード例 #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 (FollowerCount != null)
         {
             hashCode = hashCode * 59 + FollowerCount.GetHashCode();
         }
         if (FriendCount != null)
         {
             hashCode = hashCode * 59 + FriendCount.GetHashCode();
         }
         if (MeasurementPreference != null)
         {
             hashCode = hashCode * 59 + MeasurementPreference.GetHashCode();
         }
         if (Ftp != null)
         {
             hashCode = hashCode * 59 + Ftp.GetHashCode();
         }
         if (Weight != null)
         {
             hashCode = hashCode * 59 + Weight.GetHashCode();
         }
         if (Clubs != null)
         {
             hashCode = hashCode * 59 + Clubs.GetHashCode();
         }
         if (Bikes != null)
         {
             hashCode = hashCode * 59 + Bikes.GetHashCode();
         }
         if (Shoes != null)
         {
             hashCode = hashCode * 59 + Shoes.GetHashCode();
         }
         return(hashCode);
     }
 }