New to Telerik UI for WinForms? Start a free 30-day trial

Enumerates occurrences generated by an event's recurrence rule, optionally bounded by inclusive start-time limits. This object is both the enumerable and its enumerator; create a new instance for each independent pass.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.Scheduler.dll

Syntax:

C#
public class OccurrenceEnumerator : IDisposable, IEnumerator, IEnumerable

Inheritance: objectOccurrenceEnumerator

Implements: IDisposableIEnumerableIEnumerator

Constructors

Creates a range-limited enumerator that can optionally include occurrences covered by exception events or dates.

C#
public OccurrenceEnumerator(IEvent recurringEvent, DateTimeFormatInfo dateTimeFormat, DateTime from, DateTime to, bool checkExceptions)
Parameters:recurringEventIEvent

The event whose recurrence rule is enumerated.

dateTimeFormatDateTimeFormatInfo

Date information used when calculating occurrences; null uses the current culture.

fromDateTime

The earliest included occurrence start time.

toDateTime

The latest included occurrence start time.

checkExceptionsbool

true to skip exception occurrences; false to include them.

Creates an enumerator limited to occurrence start times within the specified inclusive range.

C#
public OccurrenceEnumerator(IEvent recurringEvent, DateTimeFormatInfo dateTimeFormat, DateTime from, DateTime to)
Parameters:recurringEventIEvent

The event whose recurrence rule is enumerated.

dateTimeFormatDateTimeFormatInfo

Date information used when calculating occurrences; null uses the current culture.

fromDateTime

The earliest included occurrence start time.

toDateTime

The latest included occurrence start time.

Creates an enumerator using the supplied culture-specific date information.

C#
public OccurrenceEnumerator(IEvent recurringEvent, DateTimeFormatInfo dateTimeFormat)
Parameters:recurringEventIEvent

The event whose recurrence rule is enumerated.

dateTimeFormatDateTimeFormatInfo

Date information used when calculating occurrences; null uses the current culture.

Creates an enumerator for all occurrences of the event's recurrence rule.

C#
public OccurrenceEnumerator(IEvent recurringEvent)
Parameters:recurringEventIEvent

The event whose recurrence rule is enumerated.

Fields

The start time used by Current to create the current occurrence.

C#
protected DateTime? currentOccurrenceStart

Inclusive lower bound for occurrence start times.

C#
protected DateTime fromLimit

The index used to request the next candidate from the recurrence rule.

C#
protected int occurrenceIndex

The number of candidates that matched the recurrence pattern so far.

C#
protected int occurrencesCount

The date from which candidate dates are generated; rule-specific skipping can advance it.

C#
protected DateTime? occurrenceStartDate

The recurring event whose rule supplies candidate occurrences.

C#
protected IEvent recurringEvent

Inclusive upper bound for occurrence start times.

C#
protected DateTime toLimit

Properties

Gets a newly created event instance when the enumerator is positioned on an occurrence.

C#
public virtual IEvent Current { get; }
Exceptions: InvalidOperationException

No current occurrence start has been set.

Gets or sets the culture-specific date information used to calculate recurrence patterns. Assigning null restores the current culture's date format.

C#
public virtual DateTimeFormatInfo CurrentDateTimeFormat { get; set; }

Methods

Resets the enumerator's position and counters.

C#
public void Dispose()

Implements: IDisposable.Dispose()

Returns this instance as the enumerator; it is not reset automatically for another pass.

C#
public IEnumerator<IEvent> GetEnumerator()
Returns:

IEnumerator<IEvent>

This occurrence enumerator.

Returns a single-pass enumerable of occurrences within the inclusive range, with control over exception filtering.

C#
public static IEnumerable<IEvent> GetOccurrences(IEvent appointment, DateTime from, DateTime to, bool checkExceptions)
Parameters:appointmentIEvent

The recurring event to enumerate; null produces no occurrences.

fromDateTime

The earliest included occurrence start time.

toDateTime

The latest included occurrence start time.

checkExceptionsbool

true to skip exception occurrences; false to include them.

Returns:

IEnumerable<IEvent>

An enumerable backed by an OccurrenceEnumerator instance.

Returns a single-pass enumerable of occurrences whose start times fall within the inclusive range. Exception occurrences are skipped.

C#
public static IEnumerable<IEvent> GetOccurrences(IEvent appointment, DateTime from, DateTime to)
Parameters:appointmentIEvent

The recurring event to enumerate; null produces no occurrences.

fromDateTime

The earliest included occurrence start time.

toDateTime

The latest included occurrence start time.

Returns:

IEnumerable<IEvent>

An enumerable backed by an OccurrenceEnumerator instance.

Advances to the next occurrence without time-zone conversion.

C#
public virtual bool MoveNext()
Returns:

bool

true if another occurrence is available; otherwise, false.

Implements: IEnumerator.MoveNext()

Advances to the next occurrence, optionally converting its start time before applying the configured range limits.

C#
public virtual bool MoveNext(SchedulerTimeZone system, SchedulerTimeZone active)
Parameters:systemSchedulerTimeZone

The source time zone for conversion; conversion is skipped unless active is also supplied.

activeSchedulerTimeZone

The target time zone used to convert occurrence start times for range checks.

Returns:

bool

true if another occurrence is available; otherwise, false.

Returns the enumeration to its initial position while retaining its date range and date format.

C#
public virtual void Reset()

Implements: IEnumerator.Reset()