Пример #1
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = Years.GetHashCode();
         hashCode = (hashCode * 397) ^ Months.GetHashCode();
         hashCode = (hashCode * 397) ^ Weeks.GetHashCode();
         hashCode = (hashCode * 397) ^ Days.GetHashCode();
         hashCode = (hashCode * 397) ^ Hours.GetHashCode();
         hashCode = (hashCode * 397) ^ Minutes.GetHashCode();
         hashCode = (hashCode * 397) ^ Seconds.GetHashCode();
         hashCode = (hashCode * 397) ^ Milliseconds.GetHashCode();
         hashCode = (hashCode * 397) ^ Microseconds.GetHashCode();
         return hashCode;
     }
 }
Пример #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Years.GetHashCode();
         hashCode = (hashCode * 397) ^ Months.GetHashCode();
         hashCode = (hashCode * 397) ^ Days.GetHashCode();
         hashCode = (hashCode * 397) ^ Hours.GetHashCode();
         hashCode = (hashCode * 397) ^ Minutes.GetHashCode();
         hashCode = (hashCode * 397) ^ Seconds.GetHashCode();
         hashCode = (hashCode * 397) ^ Milliseconds.GetHashCode();
         hashCode = (hashCode * 397) ^ DaysInMonth.GetHashCode();
         return(hashCode);
     }
 }
Пример #3
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 :)

                hashCode = hashCode * 59 + Years.GetHashCode();

                hashCode = hashCode * 59 + Months.GetHashCode();

                hashCode = hashCode * 59 + Days.GetHashCode();

                hashCode = hashCode * 59 + Hours.GetHashCode();

                hashCode = hashCode * 59 + Minutes.GetHashCode();

                hashCode = hashCode * 59 + Milliseconds.GetHashCode();

                hashCode = hashCode * 59 + TotalYears.GetHashCode();

                hashCode = hashCode * 59 + TotalMonths.GetHashCode();

                hashCode = hashCode * 59 + TotalDays.GetHashCode();

                hashCode = hashCode * 59 + TotalHours.GetHashCode();

                hashCode = hashCode * 59 + TotalMinutes.GetHashCode();

                hashCode = hashCode * 59 + TotalSeconds.GetHashCode();

                hashCode = hashCode * 59 + TotalMilliseconds.GetHashCode();

                hashCode = hashCode * 59 + Ticks.GetHashCode();
                return(hashCode);
            }
        }
Пример #4
0
 /// <summary>
 ///   Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 ///   A hash code for this instance, suitable for use in hashing algorithms and data
 ///   structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     return(Milliseconds.GetHashCode());
 }
Пример #5
0
 public override int GetHashCode() => StaticTimeValue.HasValue
                 ? StaticTimeValue.Value.GetHashCode()
                 : Milliseconds.GetHashCode();
Пример #6
0
 public override int GetHashCode() => StaticTimeValue.HasValue
                 ? StaticTimeValue.Value.GetHashCode()
 // ReSharper disable once NonReadonlyMemberInGetHashCode
                 : Milliseconds.GetHashCode();