RecurrencePattern Class |
Namespace: Kettic.AspNet.Controls
The RecurrencePattern type exposes the following members.
Name | Description | |
---|---|---|
RecurrencePattern |
Name | Description | |
---|---|---|
Equals(Object) |
Overloaded. Overridden. Returns a value indicating whether this instance is equal
to a specified object.
(Overrides ObjectEquals(Object).) | |
Equals(RecurrencePattern) |
Overloaded. Overridden. Returns a value indicating whether this instance is equal
to a specified RecurrencePattern object.
| |
GetHashCode | Overriden. Returns the hash code for this instance. (Overrides ObjectGetHashCode.) |
Name | Description | |
---|---|---|
Equality |
Determines whether two specified RecurrencePattern objects have the
same value.
| |
Inequality |
Determines whether two specified RecurrencePattern objects have
different values.
|
Name | Description | |
---|---|---|
DayOfMonth | Gets or sets the day month on which the event recurs. | |
DayOrdinal | ||
DaysOfWeekMask |
Gets or sets the bit mask that specifies the week days on which the event
recurs.
| |
FirstDayOfWeek | Gets or sets the day on which the week starts. | |
Frequency | Gets or sets the frequency of recurrence. | |
Interval | Gets or sets the interval of recurrence. | |
Month | Gets or sets the month on which the event recurs. |
The properties of the RecurrencePattern class work together to define a complete pattern definition to be used by the RecurrenceRule engine.
You should not need to work with it directly as specialized RecurrenceRule classes are provided for the supported modes of recurrence. They take care of constructing appropriate RecurrencePattern objects.
using System; using Kettic.AspNet.Controls; namespace RecurrenceExamples { class RecurrencePatternExample { static void Main() { // Creates a sample appointment that starts at 6/1/2007 3:30 PM and lasts half an hour. Appointment recurringAppointment = new Appointment("1", Convert.ToDateTime("6/1/2007 3:30 PM"), Convert.ToDateTime("6/1/2007 4:00 PM"), "Sample appointment"); // Creates a recurrence range, that specifies a limit of 10 occurrences for the appointment. RecurrenceRange range = new RecurrenceRange(); range.Start = recurringAppointment.Start; range.EventDuration = recurringAppointment.End - recurringAppointment.Start; range.MaxOccurrences = 10; // Creates a recurrence rule for the appointment. DailyRecurrenceRule rrule = new DailyRecurrenceRule(1, range); // Displays the relevant parts of the generated pattern: Console.WriteLine("The active recurrence pattern is:"); Console.WriteLine(" Frequency: {0}", rrule.Pattern.Frequency); Console.WriteLine(" Interval: {0}", rrule.Pattern.Interval); Console.WriteLine(" Days of week: {0}\n", rrule.Pattern.DaysOfWeekMask); Console.WriteLine("Appointment occurrs at the following times: "); int ix = 0; foreach (DateTime occurrence in rrule.Occurrences) { ix = ix + 1; Console.WriteLine("{0,2}: {1}", ix, occurrence.ToLocalTime()); } } } } /* This example produces the following results: The active recurrence pattern is: Frequency: Daily Interval: 1 Days of week: EveryDay Appointment occurrs at the following times: 1: 6/1/2007 3:30:00 PM 2: 6/2/2007 3:30:00 PM 3: 6/3/2007 3:30:00 PM 4: 6/4/2007 3:30:00 PM 5: 6/5/2007 3:30:00 PM 6: 6/6/2007 3:30:00 PM 7: 6/7/2007 3:30:00 PM 8: 6/8/2007 3:30:00 PM 9: 6/9/2007 3:30:00 PM 10: 6/10/2007 3:30:00 PM*/