RecurrenceRange
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:
public class RecurrenceRange : IEquatable<RecurrenceRange>
Inheritance: objectRecurrenceRange
Implements:
Inherited Members
Example:
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
*/
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.
public RecurrenceRange()
Overloaded. Initializes a new instance of the RecurrenceRange class with to the specified Start, EventDuration, RecursUntil and MaxOccurrences values.
public RecurrenceRange(DateTime start, TimeSpan duration, DateTime recursUntil, int maxOccurrences)
The start of the recurring event.
durationTimeSpanThe duration of the recurring event.
recursUntilDateTimeOptional end date for the recurring appointment. Defaults to no end date (DateTime.MaxValue).
maxOccurrencesintOptional limit for the number of occurrences. Defaults to no limit (Int32.MaxInt).
Properties
The duration of the recurring event.
public TimeSpan EventDuration { get; set; }
Optional limit for the number of occurrences. Defaults to no limit (Int32.MaxInt).
public int MaxOccurrences { get; set; }
Optional end date for the recurring appointment. Defaults to no end date (DateTime.MaxValue).
public DateTime RecursUntil { get; set; }
Methods
Overloaded. Overridden. Returns a value indicating whether this instance is equal to a specified object.
public override bool Equals(object obj)
An object to compare with this instance.
Returns:true if value is an instance of RecurrenceRange and equals the value of this instance; otherwise, false.
Overrides:
Overloaded. Overridden. Returns a value indicating whether this instance is equal to a specified RecurrenceRange object.
public bool Equals(RecurrenceRange other)
An RecurrenceRange object to compare with this instance.
Returns:true if value equals the value of this instance; otherwise, false.
Implements:
Overriden. Returns the hash code for this instance.
Operators
Determines whether two specified RecurrenceRange objects have different values.
public static bool operator !=(RecurrenceRange o1, RecurrenceRange o2)
Determines whether two specified RecurrenceRange objects have the same value.
public static bool operator ==(RecurrenceRange o1, RecurrenceRange o2)