public RecurrenceEnumerator GetEnumerator()
Public Function GetEnumerator As RecurrenceEnumerator
public:
RecurrenceEnumerator^ GetEnumerator()
member GetEnumerator : unit -> RecurrenceEnumerator
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.
// 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);
' 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)
Next
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.