RecurrenceHolidays Property
This is used to add holidays to the recurrence holiday list. These will be used in conjunction with
the
CanOccurOnHoliday option if it is set to false.
Namespace: EWSoftware.PDIAssembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2023.1.2.0
public static HolidayCollection Holidays { get; }
Public Shared ReadOnly Property Holidays As HolidayCollection
Get
public:
static property HolidayCollection^ Holidays {
HolidayCollection^ get ();
}
static member Holidays : HolidayCollection with get
Property Value
HolidayCollection Note that the holiday list is static and will be shared amongst all instances of the
Recurrence class to save having to assign it to each new instance.
This example shows one way to add holidays to the recurrence to prevent instances
from occurring on them.
// Create a set of fixed and floating holidays. The recurrence holiday collection
// is static.
Recurrence.Holidays.Clear();
Recurrence.Holidays.AddFixed(1, 1, true, "New Year's Day");
Recurrence.Holidays.AddFloating(DayOccurrence.Third, DayOfWeek.Monday, 1, 0,
"Martin Luther King Day");
Recurrence.Holidays.AddFloating(DayOccurrence.Third, DayOfWeek.Monday, 2, 0,
"President's Day");
Recurrence.Holidays.AddFloating(DayOccurrence.Last, DayOfWeek.Monday, 5, 0,
"Memorial Day");
Recurrence.Holidays.AddFixed(6, 19, true, "Juneteenth").MinimumYear = 2021;
Recurrence.Holidays.AddFixed(7, 4, true, "Independence Day");
Recurrence.Holidays.AddFloating(DayOccurrence.First, DayOfWeek.Monday, 9, 0,
"Labor Day");
Recurrence.Holidays.AddFixed(11, 11, true, "Veteran's Day");
Recurrence.Holidays.AddFloating(DayOccurrence.Fourth, DayOfWeek.Thursday, 11, 0,
"Thanksgiving Day");
Recurrence.Holidays.AddFloating(DayOccurrence.Fourth, DayOfWeek.Thursday, 11, 1,
"Day After Thanksgiving");
Recurrence.Holidays.AddFixed(12, 25, true, "Christmas Day");
// Create a recurrence
Recurrence rRecur = new Recurrence();
// Set it to recur daily but disallow occurrences on any of the defined holidays
rRecur.CanOccurOnHoliday = false;
rRecur.RecurDaily(1);
rRecur.MaximumOccurrences = 365;
DateTimeCollection dc = rRecur.AllInstances();
' Create a set of fixed and floating holidays. The recurrence holiday collection
' is static.
Recurrence.Holidays.Clear()
Recurrence.Holidays.AddFixed(1, 1, True, "New Year's Day")
Recurrence.Holidays.AddFloating(DayOccurrence.Third, DayOfWeek.Monday, 1, 0,
"Martin Luther King Day")
Recurrence.Holidays.AddFloating(DayOccurrence.Third, DayOfWeek.Monday, 2, 0,
"President's Day")
Recurrence.Holidays.AddFloating(DayOccurrence.Last, DayOfWeek.Monday, 5, 0,
"Memorial Day")
Recurrence.Holidays.AddFixed(6, 19, True, "Juneteenth").MinimumYear = 2021
Recurrence.Holidays.AddFixed(7, 4, True, "Independence Day")
Recurrence.Holidays.AddFloating(DayOccurrence.First, DayOfWeek.Monday, 9, 0,
"Labor Day")
Recurrence.Holidays.AddFixed(11, 11, True, "Veteran's Day")
Recurrence.Holidays.AddFloating(DayOccurrence.Fourth, DayOfWeek.Thursday, 11, 0,
"Thanksgiving Day")
Recurrence.Holidays.AddFloating(DayOccurrence.Fourth, DayOfWeek.Thursday, 11, 1,
"Day After Thanksgiving")
Recurrence.Holidays.AddFixed(12, 25, True, "Christmas Day")
' Create a recurrence
Dim rRecur As New Recurrence()
' Set it to recur daily but disallow occurrences on any of the defined holidays
rRecur.CanOccurOnHoliday = False
rRecur.RecurDaily(1)
rRecur.MaximumOccurrences = 365
Dim dc As DateTimeCollection = rRecur.AllInstances()
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.