/// <summary> /// Returns if the date is included in the range. /// </summary> /// <param name="date">Inherited code: Requires comment 1.</param> /// <param name="range">Inherited code: Requires comment 2.</param> /// <returns>Inherited code: Requires comment 3.</returns> public static bool InRange(DateTime date, CalendarExDateRange range) { Debug.Assert(DateTime.Compare(range.Start, range.End) < 1, "The range should start before it ends!"); if (CompareDays(date, range.Start) > -1 && CompareDays(date, range.End) < 1) { return(true); } return(false); }
/// <summary> /// Returns true if any day in the given DateTime range is contained in /// the current CalendarDateRange. /// </summary> /// <param name="range">Inherited code: Requires comment 1.</param> /// <returns>Inherited code: Requires comment 2.</returns> internal bool ContainsAny(CalendarExDateRange range) { Debug.Assert(range != null, "range should not be null!"); int start = DateTime.Compare(Start, range.Start); // Check if any part of the supplied range is contained by this // range or if the supplied range completely covers this range. return((start <= 0 && DateTime.Compare(End, range.Start) >= 0) || (start >= 0 && DateTime.Compare(Start, range.End) <= 0)); }