Represents a collection of ByDay objects.
For a list of all members of this type, see ByDayCollection Members.
System.Object
System.Collections.CollectionBase
Aspose.iCalendar.ByDayCollection
[Visual Basic]Public Class ByDayCollection
Remarks
Corresponds to the BYDAY part of the recurrence rule.
The BYDAY rule specifies a list of days of the week for a monthly or yearly recurrence rule.
For each day of the week, a specific Nth occurrence or all occurrences can be specified.
Example
Monthly on the 1st Friday until December 24, 1997:
[C#]
//Create the pattern programmatically.
RecurrencePattern pattern = new RecurrencePattern();
pattern.StartDate = new DateTime(1997, 9, 5, 9, 0, 0);
RecurrenceRule rule = pattern.RRules.Add();
rule.Frequency = Frequency.Monthly;
rule.Until = new DateTime(1997, 12, 24);
rule.ByDay.Add(1, DayOfWeek.Friday);
DateCollection dates = pattern.GenerateOccurrences(
new DateTime(1997, 9, 5, 9, 0, 0),
new DateTime(1998, 1, 1, 0, 0, 0));
foreach (DateTime d in dates)
Console.WriteLine(d);
...
//Create the pattern from iCalendar string.
RecurrencePattern pattern = new RecurrencePattern(
"DTSTART;TZID=US-Eastern:19970905T090000\n" +
"RRULE:FREQ=MONTHLY;UNTIL=19971224T000000Z;BYDAY=1FR");
DateCollection dates = pattern.GenerateOccurrences(
new DateTime(1997, 9, 5, 9, 0, 0),
new DateTime(1998, 1, 1, 0, 0, 0));
foreach (DateTime d in dates)
Console.WriteLine(d);
[VB]
'Create the pattern programmatically.
Dim pattern As RecurrencePattern = New RecurrencePattern
pattern.StartDate = New DateTime(1997, 9, 5, 9, 0, 0)
Dim rule As RecurrenceRule = pattern.RRules.Add()
rule.Frequency = Frequency.Monthly
rule.Until = New DateTime(1997, 12, 24)
rule.ByDay.Add(1, DayOfWeek.Friday)
Dim dates As DateCollection = pattern.GenerateOccurrences( _
New DateTime(1997, 9, 5, 9, 0, 0), New DateTime(1998, 1, 1, 0, 0, 0))
For Each d As DateTime In dates
Console.WriteLine(d)
Next
...
'Create the pattern from iCalendar string.
Dim pattern As RecurrencePattern = New RecurrencePattern( _
"DTSTART;TZID=US-Eastern:19970905T090000" + ControlChars.CrLf + _
"RRULE:FREQ=MONTHLY;UNTIL=19971224T000000Z;BYDAY=1FR")
Dim dates As DateCollection = pattern.GenerateOccurrences( _
New DateTime(1997, 9, 5, 9, 0, 0), New DateTime(1998, 1, 1, 0, 0, 0))
For Each d As DateTime In dates
Console.WriteLine(d)
Next
Requirements
Namespace: Aspose.iCalendar
Assembly: Aspose.iCalendar (in Aspose.iCalendar.dll)
See Also
ByDayCollection Members | Aspose.iCalendar Namespace