RecurrenceAllInstances Method

This method is used to return all recurring instances based on the current settings alone

Definition

Namespace: EWSoftware.PDI
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2023.1.2.0
public DateTimeCollection AllInstances()

Return Value

DateTimeCollection
Returns a DateTimeCollection of DateTime objects that represent all instances found using the current settings.

Remarks

This is best used with a recurrence that ends after a specific number of occurrences or by a specific date. If set to never end, this will return a really large collection of dates.

Example

This example shows the use of the RecurUntil and the AllInstances methods for data binding. The InstancesBetween method could be used in place of AllInstances if the recurrence was set to never end.
C#
protected System.Web.UI.WebControls.DropDownList cboNewDate;

DateTime dtFirstDate = DateTime.Today;

// Only let the user pick a date that falls on a Monday that is between 1 week and
// 6 months from today.
Recurrence rRecur = new Recurrence();

rRecur.RecurWeekly(1, DaysOfWeek.Monday);
rRecur.StartDateTime = dtFirstDate.AddDays(7);
rRecur.RecurUntil = dtFirstDate.AddMonths(6);

cboNewDate.DataTextFormatString = "{0:d}";
cboNewDate.DataSource = rRecur.AllInstances();
cboNewDate.DataBind();

See Also