New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

Specifies the pattern that RecurrenceRule uses to evaluate the recurrence dates set.

The properties of the RecurrencePattern class work together to define a complete pattern definition to be used by the RecurrenceRule engine.

You should not need to work with it directly as specialized RecurrenceRule classes are provided for the supported modes of recurrence. They take care of constructing appropriate RecurrencePattern objects.

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
public class RecurrencePattern : IEquatable<RecurrencePattern>

Inheritance: objectRecurrencePattern

Implements: IEquatable<RecurrencePattern>

Inherited Members object.ToString()object.Equals(object, object)object.ReferenceEquals(object, object)object.GetType()object.MemberwiseClone()

Example:

csharp
using System;
using Telerik.Web.UI;

namespace RecurrenceExamples
{
    class RecurrencePatternExample
    {
        static void Main()
        {
            // Creates a sample appointment that starts at 6/1/2007 3:30 PM and lasts half an hour.
            Appointment recurringAppointment = new Appointment("1", Convert.ToDateTime("6/1/2007 3:30 PM"),
                Convert.ToDateTime("6/1/2007 4:00 PM"), "Sample appointment");

            // Creates a recurrence range, that specifies a limit of 10 occurrences for the appointment.
            RecurrenceRange range = new RecurrenceRange();
            range.Start = recurringAppointment.Start;
            range.EventDuration = recurringAppointment.End - recurringAppointment.Start;
            range.MaxOccurrences = 10;

            // Creates a recurrence rule for the appointment.
            DailyRecurrenceRule rrule = new DailyRecurrenceRule(1, range);

            // Displays the relevant parts of the generated pattern:
            Console.WriteLine("The active recurrence pattern is:");
            Console.WriteLine("  Frequency: {0}", rrule.Pattern.Frequency);
            Console.WriteLine("  Interval: {0}", rrule.Pattern.Interval);
            Console.WriteLine("  Days of week: {0}\n", rrule.Pattern.DaysOfWeekMask);

            Console.WriteLine("Appointment occurrs at the following times: ");
            int ix = 0;
            foreach (DateTime occurrence in rrule.Occurrences)
            {
                ix = ix + 1;
                Console.WriteLine("{0,2}: {1}", ix, occurrence.ToLocalTime());
            }
        }
    }
}

/*
This example produces the following results:

The active recurrence pattern is:
  Frequency: Daily
  Interval: 1
  Days of week: EveryDay

Appointment occurrs at the following times:
 1: 6/1/2007 3:30:00 PM
 2: 6/2/2007 3:30:00 PM
 3: 6/3/2007 3:30:00 PM
 4: 6/4/2007 3:30:00 PM
 5: 6/5/2007 3:30:00 PM
 6: 6/6/2007 3:30:00 PM
 7: 6/7/2007 3:30:00 PM
 8: 6/8/2007 3:30:00 PM
 9: 6/9/2007 3:30:00 PM
10: 6/10/2007 3:30:00 PM
*/
csharp
Imports System
Imports Telerik.Web.UI

Namespace RecurrenceExamples
    Class RecurrencePatternExample
        Shared Sub Main()
            ' Creates a sample appointment that starts at 6/1/2007 3:30 PM and lasts half an hour.
            Dim recurringAppointment As New Appointment("1", Convert.ToDateTime("6/1/2007 3:30 PM"), Convert.ToDateTime("6/1/2007 4:00 PM"), "Sample appointment")

            ' Creates a recurrence range, that specifies a limit of 10 occurrences for the appointment.
            Dim range As New RecurrenceRange()
            range.Start = recurringAppointment.Start
            range.EventDuration = recurringAppointment.[End] - recurringAppointment.Start
            range.MaxOccurrences = 10

            ' Creates a recurrence rule for the appointment.
            Dim rrule As New DailyRecurrenceRule(1, range)

            ' Displays the relevant parts of the generated pattern:
            Console.WriteLine("The active recurrence pattern is:")
            Console.WriteLine("  Frequency: {0}", rrule.Pattern.Frequency)
            Console.WriteLine("  Interval: {0}", rrule.Pattern.Interval)
            Console.WriteLine("  Days of week: {0}" & Chr(10) & "", rrule.Pattern.DaysOfWeekMask)

            Console.WriteLine("Appointment occurrs at the following times: ")
            Dim ix As Integer = 0
            For Each occurrence As DateTime In rrule.Occurrences
                ix = ix + 1
                Console.WriteLine("{0,2}: {1}", ix, occurrence.ToLocalTime())
            Next
        End Sub
    End Class
End Namespace

'
'This example produces the following results:
'
'The active recurrence pattern is:
'  Frequency: Daily
'  Interval: 1
'  Days of week: EveryDay
'
'Appointment occurrs at the following times:
' 1: 6/1/2007 3:30:00 PM
' 2: 6/2/2007 3:30:00 PM
' 3: 6/3/2007 3:30:00 PM
' 4: 6/4/2007 3:30:00 PM
' 5: 6/5/2007 3:30:00 PM
' 6: 6/6/2007 3:30:00 PM
' 7: 6/7/2007 3:30:00 PM
' 8: 6/8/2007 3:30:00 PM
' 9: 6/9/2007 3:30:00 PM
'10: 6/10/2007 3:30:00 PM
'

Constructors

C#
public RecurrencePattern()

Properties

Gets or sets the day month on which the event recurs.

C#
public int DayOfMonth { get; set; }
Property Value:

The day month on which the event recurs.

C#
public int DayOrdinal { get; set; }

This property is meaningful only when RecurrenceFrequency is set to Monthly or Yearly and DayOfMonth is not set.

In such scenario it selects the n-th occurrence within the set of events specified by the rule. Valid values are from -31 to +31, 0 is ignored.

For example with RecurrenceFrequency set to Monthly and DaysOfWeekMask set to Monday DayOfMonth is interpreted in the following way:

    • 1: Selects the first monday of the month.
    • 3: Selects the third monday of the month.
    • -1: Selects the last monday of the month.

For detailed examples see the documentation of the MonthlyRecurrenceRule class.

Gets or sets the bit mask that specifies the week days on which the event recurs.

C#
public RecurrenceDay DaysOfWeekMask { get; set; }
Property Value:

A bit mask that specifies the week days on which the event recurs.

For additional information on how to create masks see the RecurrenceDay documentation.

Gets or sets the day on which the week starts.

C#
public DayOfWeek FirstDayOfWeek { get; set; }
Property Value:

This property is only meaningful when RecurrenceFrequency is set to Weekly and Interval is greater than 1.

Gets or sets the frequency of recurrence.

C#
public RecurrenceFrequency Frequency { get; set; }
Property Value:

A RecurrenceFrequency enumerated constant that indicates the frequency of recurrence.

The default value is None.

Gets or sets the interval of recurrence.

C#
public int Interval { get; set; }
Property Value:

A positive integer representing how often the recurrence rule repeats, expressed in RecurrenceFrequency units.

The default value is 1.

Gets or sets the month on which the event recurs.

C#
public RecurrenceMonth Month { get; set; }
Property Value:

This property is only meaningful when RecurrenceFrequency is set to Yearly.

Methods

Overloaded. Overridden. Returns a value indicating whether this instance is equal to a specified object.

C#
public override bool Equals(object obj)
Parameters:objobject

An object to compare with this instance.

Returns:

bool

true if value is an instance of RecurrencePattern and equals the value of this instance; otherwise, false.

Overrides: object.Equals(object)

Overloaded. Overridden. Returns a value indicating whether this instance is equal to a specified RecurrencePattern object.

C#
public bool Equals(RecurrencePattern other)
Parameters:otherRecurrencePattern

An RecurrencePattern object to compare with this instance.

Returns:

bool

true if value equals the value of this instance; otherwise, false.

Implements: IEquatable<RecurrencePattern>.Equals(RecurrencePattern)

Overriden. Returns the hash code for this instance.

C#
public override int GetHashCode()
Returns:

int

The hash code for this instance.

Overrides: object.GetHashCode()

Operators

Determines whether two specified RecurrencePattern objects have different values.

C#
public static bool operator !=(RecurrencePattern o1, RecurrencePattern o2)
Parameters:o1RecurrencePatterno2RecurrencePatternReturns:

bool

Determines whether two specified RecurrencePattern objects have the same value.

C#
public static bool operator ==(RecurrencePattern o1, RecurrencePattern o2)
Parameters:o1RecurrencePatterno2RecurrencePatternReturns:

bool