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

            return
                ((
                     DayOfYear == other.DayOfYear ||

                     DayOfYear.Equals(other.DayOfYear)
                     ) &&
                 (
                     DayOfWeek == other.DayOfWeek ||

                     DayOfWeek.Equals(other.DayOfWeek)
                 ) &&
                 (
                     WeekOfYear == other.WeekOfYear ||

                     WeekOfYear.Equals(other.WeekOfYear)
                 ) &&
                 (
                     SecondsInDay == other.SecondsInDay ||

                     SecondsInDay.Equals(other.SecondsInDay)
                 ) &&
                 (
                     MinutesInDay == other.MinutesInDay ||

                     MinutesInDay.Equals(other.MinutesInDay)
                 ) &&
                 (
                     Ticks == other.Ticks ||

                     Ticks.Equals(other.Ticks)
                 ));
        }
示例#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);
            }
        }