/// <summary>
        /// Determines the number of days from one DayOfWeek till the next.
        /// </summary>
        /// <param name="self">the starting DayOfWeek</param>
        /// <param name="next">The ending DayOfWeek</param>
        /// <returns>the number of days from <paramref name="self"/> to <paramref name="next"/></returns>
        /// <exception cref="ArgumentOutOfRangeException">If either DayOfWeek is not 
        /// <see cref="DayOfWeekExtensions.InRange"/></exception>
        /// <example>
        /// Debug.Assert(DayOfWeek.Monday.DaysTill(DayOfWeek.Tuesday) == 1);
        /// </example>
        public static int DaysTill(this DayOfWeek self, DayOfWeek next)
        {
            self.CheckRange();
            next.CheckRange();

            return DaysBetween((int)next, (int)self);
        }
        /// <summary>
        /// Determines the number of days since one DayOfWeek since the previous.
        /// </summary>
        /// <param name="self">the starting DayOfWeek</param>
        /// <param name="prev">The previous DayOfWeek</param>
        /// <returns>the number of days since <paramref name="self"/> to <paramref name="prev"/></returns>
        /// <exception cref="ArgumentOutOfRangeException">If either DayOfWeek is not 
        /// <see cref="DayOfWeekExtensions.InRange"/></exception>
        /// <example>
        /// Debug.Assert(DayOfWeek.Tuesday.DaysSince(DayOfWeek.Monday) == 1);
        /// </example>
        public static int DaysSince(this DayOfWeek self, DayOfWeek prev)
        {
            self.CheckRange();
            prev.CheckRange();

            return DaysBetween((int)self, (int)prev);
        }
Beispiel #3
0
        /// <summary>
        ///     Determines the number of days since one DayOfWeek since the previous.
        /// </summary>
        /// <param name="self">the starting DayOfWeek</param>
        /// <param name="prev">The previous DayOfWeek</param>
        /// <returns>the number of days since <paramref name="self" /> to <paramref name="prev" /></returns>
        /// <exception cref="ArgumentOutOfRangeException">
        ///     If either DayOfWeek is not
        ///     <see cref="DayOfWeekExtensions.InRange" />
        /// </exception>
        /// <example>
        ///     Debug.Assert(DayOfWeek.Tuesday.DaysSince(DayOfWeek.Monday) == 1);
        /// </example>
        public static int DaysSince(this DayOfWeek self, DayOfWeek prev)
        {
            self.CheckRange();
            prev.CheckRange();

            return(DaysBetween((int)self, (int)prev));
        }
Beispiel #4
0
        /// <summary>
        ///     Determines the number of days from one DayOfWeek till the next.
        /// </summary>
        /// <param name="self">the starting DayOfWeek</param>
        /// <param name="next">The ending DayOfWeek</param>
        /// <returns>the number of days from <paramref name="self" /> to <paramref name="next" /></returns>
        /// <exception cref="ArgumentOutOfRangeException">
        ///     If either DayOfWeek is not
        ///     <see cref="DayOfWeekExtensions.InRange" />
        /// </exception>
        /// <example>
        ///     Debug.Assert(DayOfWeek.Monday.DaysTill(DayOfWeek.Tuesday) == 1);
        /// </example>
        public static int DaysTill(this DayOfWeek self, DayOfWeek next)
        {
            self.CheckRange();
            next.CheckRange();

            return(DaysBetween((int)next, (int)self));
        }
        /// <summary>
        /// Determines the number of days since one DayOfWeek since the previous.
        /// </summary>
        /// <param name="dt">the starting DayOfWeek</param>
        /// <param name="prevDoW">The previous DayOfWeek</param>
        /// <returns>the number of days since <paramref name="dt"/> to <paramref name="prevDoW"/></returns>
        /// <exception cref="ArgumentOutOfRangeException">If either DayOfWeek is not
        /// <see cref="InRange"/></exception>
        /// <example>
        /// Debug.Assert(DayOfWeek.Tuesday.DaysSince(DayOfWeek.Monday) == 1);
        /// </example>
        public static int DaysSince(this DayOfWeek dt, DayOfWeek prevDoW)
        {
            dt.CheckRange();
            prevDoW.CheckRange();

            return(daysBetween((int)dt, (int)prevDoW));
        }
        public static int DaysTill(this DayOfWeek dt, DayOfWeek nextDoW)
        {
            dt.CheckRange();
            nextDoW.CheckRange();

            return(daysBetween((int)nextDoW, (int)dt));
        }