Represents a component that holds a set of time patterns which describe when to raise an event.
[Visual Basic] Public Class Schedule Inherits Component Implements ISupportInitialize [C#] public class Schedule : Component, ISupportInitialize [C++] public __gc class Schedule : public Component, ISupportInitialize [JScript] public class Schedule extends Component, ISupportInitialize
RecurrencePatterns keeps a collection of recurrence patterns that describe the Schedule component's behavior on raising events. Use the RecurrencePatterns property to define the RecurrencePatterns.
Schedule can be used to raise more than one event. You must use AddOnEventOccurred to specify each event you want raised on the schedule specified through the RecurrencePatterns property. The events will be raised one at a time, in the order that they are added.
Note Every event added to a single Schedule will be raised using the same patterns. If you want an event to be raised according to a different pattern, you must create a separate instance of Schedule for that event.
There are two ways to add a recurrence pattern to RecurrencePatterns. Use Add if you have a recurrence pattern that is previously defined. If you define a recurrence pattern before adding it to the collection, you can add it to multiple RecurrencePatterns collections without making a copy of the recurrence pattern. However, if you use one of the AddDailyPattern, AddDaysOfMonthPattern, AddMonthlyPattern, or AddWeeklyPattern methods, you will create the recurrence pattern while adding it to the collection.
Combine various recurrence patterns to get the ultimate pattern you want. However, it is important to understand how combinations work together. For example, you want an event raised at 4:00am and 4:00pm on the 1st and 15th of every month, and the first Monday of July at 2:00pm, on every third Wednesday and Friday at 3:00pm, and every 4 days at 1:00pm starting from the date the pattern becomes valid, you will need to define several patterns. First, create DaysOfMonthPattern1 to raise the event at 4:00am on the 1st and 15th of every month, then create DaysOfMonthPattern2 to raise the event at 4:00pm on the 1st and 15th of every month. Next, create MonthlyPattern1 to raise the event on the first Monday of July at 2:00pm. Third, create WeeklyPattern1 which raises the event on Wednesday and Friday at 3:00pm with the EveryNthWeek property of the WeeklyPattern equal to 3. Finally, create DailyPattern1 to raise the event at 1:00pm every 4 days, starting the specified valid start date. For more information on creating and using these patterns, see DailyPattern, DaysOfMonthPattern, MonthlyPattern, RecurrencePatterns, and WeeklyPattern.
Namespace: System.Timers
Assembly: System.Timers.dll
Schedule Members | System.Timers Namespace | Add | AddDailyPattern | AddDaysOfMonthPattern | AddMonthlyPattern | AddWeeklyPattern | All | DailyPattern | DaysOfMonthPattern | EveryNthWeek | MonthlyPattern | RecurrencePatterns | Timer | WeeklyPattern