/// <summary> /// Returns true if any day in the given DateTime range is contained in /// the current CalendarDateRange. /// </summary> /// <param name="value">The current range.</param> /// <param name="range">The range to compare.</param> /// <param name="info">The CalendarInfo.</param> /// <returns> /// A value indicating whether any day in the given DateTime range is\ /// contained in the current CalendarDateRange. /// </returns> public static bool ContainsAny(this CalendarDateRange value, CalendarDateRange range, CalendarInfo info) { Debug.Assert(value != null, "value should not be null!"); Debug.Assert(range != null, "range should not be null!"); Debug.Assert(info != null, "info should not be null!"); int start = info.Compare(value.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 && info.Compare(value.End, range.Start) >= 0) || (start >= 0 && info.Compare(value.Start, range.End) <= 0); }
/// <summary> /// Returns true if any day in the given DateTime range is contained in /// the current CalendarDateRange. /// </summary> /// <param name="value">The current range.</param> /// <param name="range">The range to compare.</param> /// <param name="info">The CalendarInfo.</param> /// <returns> /// A value indicating whether any day in the given DateTime range is\ /// contained in the current CalendarDateRange. /// </returns> public static bool ContainsAny(this CalendarDateRange value, CalendarDateRange range, CalendarInfo info) { Debug.Assert(value != null, "value should not be null!"); Debug.Assert(range != null, "range should not be null!"); Debug.Assert(info != null, "info should not be null!"); int start = info.Compare(value.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 && info.Compare(value.End, range.Start) >= 0) || (start >= 0 && info.Compare(value.Start, range.End) <= 0)); }