Class RecurrenceEvaluator
Evaluates a RecurrenceRule (RFC 5545 §3.3.10) to generate occurrence
date-times. Given a rule and a start date-time (DTSTART), the evaluator produces the
ordered set of date-times that satisfy the rule, bounded by COUNT, UNTIL,
or an explicit range.
Inherited Members
Namespace: DRIT.Mail.Rfc.ICal
Assembly: DRIT.Mail.dll
Syntax
public static class RecurrenceEvaluator
Remarks
The evaluation follows the algorithm described in RFC 5545 §3.3.10. For each
interval period (determined by FREQ and INTERVAL), candidate date-times
are generated by applying the BY* rules in the order defined by the
specification:
BYMONTHBYWEEKNOBYYEARDAYBYMONTHDAYBYDAYBYHOURBYMINUTEBYSECOND
After expansion, BYSETPOS selects specific positions within the period's
candidate set. The result is filtered by UNTIL and limited by COUNT.
The first occurrence is always DTSTART itself, provided it falls within the bounds. Per RFC 5545 §3.3.10, the recurrence set is generated by considering the period containing DTSTART as the first period, even if DTSTART does not strictly match the BY* rules (DTSTART is always included as the first occurrence).
Fields
View SourceDefaultMaxOccurrences
The default maximum number of occurrences generated when neither COUNT,
UNTIL, nor an explicit range bound the result. This guards against
unbounded recurrence rules (e.g. FREQ=DAILY with no end).
Declaration
public const int DefaultMaxOccurrences = 1000
Field Value
| Type | Description |
|---|---|
| int |
Remarks
The evaluation follows the algorithm described in RFC 5545 §3.3.10. For each
interval period (determined by FREQ and INTERVAL), candidate date-times
are generated by applying the BY* rules in the order defined by the
specification:
BYMONTHBYWEEKNOBYYEARDAYBYMONTHDAYBYDAYBYHOURBYMINUTEBYSECOND
After expansion, BYSETPOS selects specific positions within the period's
candidate set. The result is filtered by UNTIL and limited by COUNT.
The first occurrence is always DTSTART itself, provided it falls within the bounds. Per RFC 5545 §3.3.10, the recurrence set is generated by considering the period containing DTSTART as the first period, even if DTSTART does not strictly match the BY* rules (DTSTART is always included as the first occurrence).
Methods
View SourceEvaluate(RecurrenceRule, ICalDateTime)
Evaluates the specified recurrence rule starting from start,
returning all occurrences. The result is bounded by COUNT or UNTIL
if present in the rule; otherwise it is bounded by
DefaultMaxOccurrences.
Declaration
public static IReadOnlyList<ICalDateTime> Evaluate(RecurrenceRule rule, ICalDateTime start)
Parameters
| Type | Name | Description |
|---|---|---|
| RecurrenceRule | rule | The recurrence rule to evaluate. Must not be null. |
| ICalDateTime | start | The start date-time (DTSTART). Must not be null. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ICalDateTime> | An ordered list of occurrence date-times, starting with |
Remarks
The evaluation follows the algorithm described in RFC 5545 §3.3.10. For each
interval period (determined by FREQ and INTERVAL), candidate date-times
are generated by applying the BY* rules in the order defined by the
specification:
BYMONTHBYWEEKNOBYYEARDAYBYMONTHDAYBYDAYBYHOURBYMINUTEBYSECOND
After expansion, BYSETPOS selects specific positions within the period's
candidate set. The result is filtered by UNTIL and limited by COUNT.
The first occurrence is always DTSTART itself, provided it falls within the bounds. Per RFC 5545 §3.3.10, the recurrence set is generated by considering the period containing DTSTART as the first period, even if DTSTART does not strictly match the BY* rules (DTSTART is always included as the first occurrence).
Evaluate(RecurrenceRule, ICalDateTime, ICalDateTime?, ICalDateTime?, int)
Evaluates the specified recurrence rule starting from start,
returning all occurrences that fall within the range
[rangeStart, rangeEnd]. The result is also
bounded by COUNT or UNTIL if present in the rule.
Declaration
public static IReadOnlyList<ICalDateTime> Evaluate(RecurrenceRule rule, ICalDateTime start, ICalDateTime? rangeStart, ICalDateTime? rangeEnd, int maxOccurrences)
Parameters
| Type | Name | Description |
|---|---|---|
| RecurrenceRule | rule | Specifies the rule value. |
| ICalDateTime | start | Specifies the start value. |
| ICalDateTime | rangeStart | The inclusive lower bound of the range, or null for no lower bound. Occurrences
before this bound are still counted toward |
| ICalDateTime | rangeEnd | The inclusive upper bound of the range, or null for no upper bound (in which case
|
| int | maxOccurrences | The maximum number of occurrences to generate, regardless of other bounds. This guards against unbounded rules. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ICalDateTime> | An ordered list of occurrence date-times within the specified range, starting with
|
Remarks
The evaluation follows the algorithm described in RFC 5545 §3.3.10. For each
interval period (determined by FREQ and INTERVAL), candidate date-times
are generated by applying the BY* rules in the order defined by the
specification:
BYMONTHBYWEEKNOBYYEARDAYBYMONTHDAYBYDAYBYHOURBYMINUTEBYSECOND
After expansion, BYSETPOS selects specific positions within the period's
candidate set. The result is filtered by UNTIL and limited by COUNT.
The first occurrence is always DTSTART itself, provided it falls within the bounds. Per RFC 5545 §3.3.10, the recurrence set is generated by considering the period containing DTSTART as the first period, even if DTSTART does not strictly match the BY* rules (DTSTART is always included as the first occurrence).