RecurrenceGet Enumerator Method
Get a type-safe Recurrence enumerator
Definition
Namespace: EWSoftware.PDI
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2025.1.9.0
A type-safe Recurrence enumerator
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2025.1.9.0
C#
public RecurrenceEnumerator GetEnumerator()VB
Public Function GetEnumerator As RecurrenceEnumeratorC++
public:
RecurrenceEnumerator^ GetEnumerator()F#
member GetEnumerator : unit -> RecurrenceEnumerator Return Value
RecurrenceEnumeratorA type-safe Recurrence enumerator
Remarks
Set up the recurrence pattern and the starting date before using the enumerator. It is best to use a recurrence that ends after a specific number of occurrences or a specific date. If enumerating one that does not end, it will go until it is about a year short of DateTime.MaxValue.
Note that this is not exposed via the IEnumerable interface. Instead, it is only used by foreach loop code or if called explicitly. As such, the object itself cannot be used as a data source for data binding. However, the DateTimeCollection returned by the InstancesBetween(DateTime, DateTime) and AllInstances methods can be used as a data source.
Example
C#
// Test daily recurrence
rRecur.RecurDaily(2);
rRecur.StartDateTime = DateTime.Today;
rRecur.RecurUntil = DateTime.Today.AddMonths(1);
// With a collection
DateTimeCollection recurDates = rRecur.InstancesBetween(DateTime.Today,
DateTime.Today.AddMonths(1));
foreach(DateTime dt in recurDates)
Console.WriteLine("Daily recurrence on: {0:d}", dt);
// Using the enumerator
foreach(DateTime dt in rRecur)
Console.WriteLine("Daily recurrence on: {0:d}", dt);VB
' Test daily recurrence
rRecur.RecurDaily(2)
rRecur.StartDateTime = DateTime.Today
rRecur.RecurUntil = DateTime.Today.AddMonths(1)
' With a collection
Dim recurDates As DateTimeCollection = rRecur.InstancesBetween(DateTime.Today,
DateTime.Today.AddMonths(1))
For Each dt In recurDates
Console.WriteLine("Daily recurrence on: {0:d}", dt)
Next
' Using the enumerator
For Each dt In rRecur
Console.WriteLine("Daily recurrence on: {0:d}", dt)
NextC++
No code example is currently available or this language may not be supported.F#
No code example is currently available or this language may not be supported.