Пример #1
0
 public override int GetHashCode() =>
 Second.GetHashCode() ^
 Minute.GetHashCode() ^
 Hour.GetHashCode() ^
 Day.GetHashCode() ^
 DayOfWeek.GetHashCode() ^
 Month.GetHashCode() ^
 Year.GetHashCode() ^
 DayOfYear.GetHashCode() ^
 IsDst.GetHashCode();
Пример #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 :)

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

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

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

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

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

                hashCode = hashCode * 59 + Ticks.GetHashCode();
                return(hashCode);
            }
        }
Пример #3
0
        public override int GetHashCode()
        {
            var hashCode = 844321305;

            hashCode = hashCode * -1521134295 + Ticks.GetHashCode();
            hashCode = hashCode * -1521134295 + Second.GetHashCode();
            hashCode = hashCode * -1521134295 + Date.GetHashCode();
            hashCode = hashCode * -1521134295 + Month.GetHashCode();
            hashCode = hashCode * -1521134295 + Minute.GetHashCode();
            hashCode = hashCode * -1521134295 + Millisecond.GetHashCode();
            hashCode = hashCode * -1521134295 + Hour.GetHashCode();
            hashCode = hashCode * -1521134295 + DayOfYear.GetHashCode();
            hashCode = hashCode * -1521134295 + DayOfWeek.GetHashCode();
            hashCode = hashCode * -1521134295 + Day.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <TimeSpan> .Default.GetHashCode(TimeOfDay);

            hashCode = hashCode * -1521134295 + Year.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <TimeSpan> .Default.GetHashCode(Offset);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Value);

            return(hashCode);
        }