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

Specifies the time frame for which given RecurrenceRule is active. It consists of the start time of the event, it's duration and optional limits.

Limits for both occurrence count and end date can be specified via the MaxOccurrences and RecursUntil properties.

Start and EventDuration properties refer to the recurring event's start and duration. In the context of RadScheduler they are usually derived from Start and End.

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
public class RecurrenceRange : IEquatable<RecurrenceRange>

Inheritance: objectRecurrenceRange

Implements: IEquatable<RecurrenceRange>

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 RecurrenceRangeExample
    {
        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 daily recurrence rule for the appointment.
            DailyRecurrenceRule rrule = new DailyRecurrenceRule(1, range);

            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:

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 RecurrenceRangeExample
        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 daily recurrence rule for the appointment.
            Dim rrule As New DailyRecurrenceRule(1, range)

            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:
'
'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

Overloaded. Initializes a new instance of the RecurrenceRange class.

C#
public RecurrenceRange()

Overloaded. Initializes a new instance of the RecurrenceRange class with to the specified Start, EventDuration, RecursUntil and MaxOccurrences values.

C#
public RecurrenceRange(DateTime start, TimeSpan duration, DateTime recursUntil, int maxOccurrences)
Parameters:startDateTime

The start of the recurring event.

durationTimeSpan

The duration of the recurring event.

recursUntilDateTime

Optional end date for the recurring appointment. Defaults to no end date (DateTime.MaxValue).

maxOccurrencesint

Optional limit for the number of occurrences. Defaults to no limit (Int32.MaxInt).

Properties

The duration of the recurring event.

C#
public TimeSpan EventDuration { get; set; }

Optional limit for the number of occurrences. Defaults to no limit (Int32.MaxInt).

C#
public int MaxOccurrences { get; set; }

Optional end date for the recurring appointment. Defaults to no end date (DateTime.MaxValue).

C#
public DateTime RecursUntil { get; set; }

The start of the recurring event.

C#
public DateTime Start { get; set; }

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 RecurrenceRange 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 RecurrenceRange object.

C#
public bool Equals(RecurrenceRange other)
Parameters:otherRecurrenceRange

An RecurrenceRange object to compare with this instance.

Returns:

bool

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

Implements: IEquatable<RecurrenceRange>.Equals(RecurrenceRange)

Overriden. Returns the hash code for this instance.

C#
public override int GetHashCode()
Returns:

int

Overrides: object.GetHashCode()

Operators

Determines whether two specified RecurrenceRange objects have different values.

C#
public static bool operator !=(RecurrenceRange o1, RecurrenceRange o2)
Parameters:o1RecurrenceRangeo2RecurrenceRangeReturns:

bool

Determines whether two specified RecurrenceRange objects have the same value.

C#
public static bool operator ==(RecurrenceRange o1, RecurrenceRange o2)
Parameters:o1RecurrenceRangeo2RecurrenceRangeReturns:

bool