Class RecurrenceList
Encapsulates the idea of a recurrence defintion. Its purpose is to accept a recurrence definition (either as a string or as RecurrenceRules) and allow you to easily decide whether particular date satisfies the defineition of recurrence. The class derives from ArrayList. The ArayList may (depending upon EnableDateCache) hold a list of known valid recurrent dates. This list is dynamic, and will grow as you use the method IsValidRecurrence(DateTime) to determine whether a date satisfies the definition of recurrence.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Schedule
Assembly: Syncfusion.Schedule.Base.dll
Syntax
public class RecurrenceList : ArrayList, IList, ICollection, IEnumerable, ICloneable
Constructors
RecurrenceList()
Initializes a new instance of the RecurrenceList class.
Declaration
public RecurrenceList()
RecurrenceList(RecurrenceRule, DateTime, IScheduleAppointment)
Initializes a new instance of the RecurrenceList class. Uses a RecurenceRule and BaseDate to define the recurrence.
Declaration
public RecurrenceList(RecurrenceRule rule, DateTime baseDate, IScheduleAppointment appointment)
Parameters
Type | Name | Description |
---|---|---|
RecurrenceRule | rule | The recurrence rule. |
System.DateTime | baseDate | The basedate. |
IScheduleAppointment | appointment | Defines the appointment associated with this recurrence. |
RecurrenceList(DateTime[], IScheduleAppointment)
Initializes a new instance of the RecurrenceList class. Accepts a fixed list of dates.
Declaration
public RecurrenceList(DateTime[] dates, IScheduleAppointment appointment)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime[] | dates | An Array of DateTime values. |
IScheduleAppointment | appointment | Defines the appointment associated with this recurrence. |
Remarks
This constructor allows you to specify a recurrence as a fix set of dates. So, if you want to set up a series of 5 meetings on 5 different dates, then you can use this constructor to do so as a recurring appointment.
RecurrenceList(String, DateTime, IScheduleAppointment)
Initializes a new instance of the RecurrenceList class. Accepts a string rule and a base date to define the recurrence.
Declaration
public RecurrenceList(string rule, DateTime baseDate, IScheduleAppointment appointment)
Parameters
Type | Name | Description |
---|---|---|
System.String | rule | The string rule. Text |
System.DateTime | baseDate | The base date. |
IScheduleAppointment | appointment | Defines the appointment associated with this recurrence. |
Properties
Appointment
Gets or sets appointment information for this recurring event.
Declaration
public IScheduleAppointment Appointment { get; set; }
Property Value
Type |
---|
IScheduleAppointment |
Remarks
When a Calendar is displaying a date that holds a recurring appointment, the information provided through this property will be used to create a placeholder appointment for this recurring event.
BaseDate
Gets or sets the start date for this recurrence.
Declaration
public DateTime BaseDate { get; set; }
Property Value
Type |
---|
System.DateTime |
Remarks
This value should be the earliest possible date that you want to be considered for this set of recurrences.
EnableDateCache
Gets or sets a value indicating whether this RecurrencList maintains a list of dates that satisfies the recurrence definition.
Declaration
public bool EnableDateCache { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
If this property is true, the ReccurenceList is an ArrayList object hodling a sorted list of the known occurrences to date. The list is fully populated in the sense that all dates between the first date in that list and the last date in the list which satisfy the recurrence definintion are also in the list. This list is used in the IsValidRecurrence(DateTime) method to check for occurences. This method first checks whether the requested date is in the list which means the method returns true. If not, it checks to see if the requested date is less than teh last date in the list, and if so, returns false. Finally, if the requested date is beyond the dates in the list, the method computes new dates that satisfy the rule and adds them to the list until ether the requested date is found, or exceeded. This means that the list dynamically grows as you request further and further dates into the future. This dynamic list technique makes validating dates to be very efficient at the expense of the memory load of maintaining the date list.
Item[Int32]
Gets of sets the ith date in this RecurrentList.
Declaration
public DateTime this[int i] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The requested index. |
Property Value
Type | Description |
---|---|
System.DateTime | A date satisfying this recurrence. |
Rules
Gets or sets an array of RecurrenceRules that defines this recurrence collection.
Declaration
public RecurrenceRule[] Rules { get; set; }
Property Value
Type |
---|
RecurrenceRule[] |
RuleString
Gets or sets a string that defines this recurrence collection.
Declaration
public string RuleString { get; set; }
Property Value
Type |
---|
System.String |
Remarks
The string may be a simple rule that qualifies (Text for sample rules). It also can be several simple rules appended together with semicolons. This RuleString is equivalent to the collection of Rules in that both RuleString and Rules define exactly the same set of recurrent dates.
TerminalDate
Gets or sets the last date associated with this recurrence definition.
Declaration
public DateTime TerminalDate { get; set; }
Property Value
Type |
---|
System.DateTime |
Methods
IsValidRecurrence(DateTime)
Determines whether the given date satisfies the recurrence definition.
Declaration
public bool IsValidRecurrence(DateTime dt)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dt | The date to be tested. |
Returns
Type | Description |
---|---|
System.Boolean | True is the date satisfies the recurrence definition. |
Remarks
If EnableDateCache is true, then this routine first does a binary search on the dates that are cached in the underlying ArrayList. If the date is not found and exceeds the last cached date, then Syncfusion.Schedule.RecurrenceSupport.GetFirstDate is called with a base date of the last known cached recurrence date. Then GetNextDate is continually called until either the given date is found to satisfy the recurrence, or the given date has been exceeded. As the dates are generated, they are inserted into the underlying ArrayList, extending the known date cache. Care is taken to insert the new dates properly so the underlying date cache is always sorted, and BinarySearch is valid. If EnableDateCache is false, then no searching is attempted in the cache which is always empty. Instead, GetFirstDate is always called with the BaseDate, and the GetNextDate is called until the given date is found or exceeded. There is no cacheing involved and all checks require starting at the beginning and computing all the dates from scratch everytime.