Пример #1
0
        /// <summary>Gets the weekend representation with respect to two <see cref="IHolidayCalendar"/> objects.
        /// </summary>
        /// <param name="holidayCalendar1">The first holiday calendar.</param>
        /// <param name="holidayCalendar2">The second holiday calendar.</param>
        /// <returns>A <see cref="IWeekendRepresentation"/> object which is the intersection of the <see cref="IWeekendRepresentation"/>
        /// objects of <paramref name="holidayCalendar1"/> and <paramref name="holidayCalendar2"/>.</returns>
        private static IWeekendRepresentation GetWeekendRepresentation(IHolidayCalendar holidayCalendar1, IHolidayCalendar holidayCalendar2)
        {
            ISet <DayOfWeek> weekendDays = new HashSet <DayOfWeek>();

            holidayCalendar1.WeekendRepresentation.AddWeekendDaysTo(weekendDays);
            holidayCalendar2.WeekendRepresentation.IntersectWeekendDaysWith(weekendDays);
            return(WeekendFactory.GetWeekend(weekendDays));
        }
        /// <summary>Gets the weekend representation of a collection of <see cref="IHolidayCalendar"/> objects.
        /// </summary>
        /// <param name="holidayCalendarCollection">The holiday calendar collection.</param>
        /// <returns>A <see cref="IWeekendRepresentation"/> object which is the union of the <see cref="IWeekendRepresentation"/>
        /// objects of the <paramref name="holidayCalendarCollection"/>.</returns>
        private static IWeekendRepresentation GetWeekendRepresentation(IEnumerable <IHolidayCalendar> holidayCalendarCollection)
        {
            ISet <DayOfWeek> weekendDays = new HashSet <DayOfWeek>();

            foreach (IHolidayCalendar holidayCalendar in holidayCalendarCollection)
            {
                holidayCalendar.WeekendRepresentation.AddWeekendDaysTo(weekendDays);
            }
            return(WeekendFactory.GetWeekend(weekendDays));
        }