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

Occurrences of this rule repeat on a monthly basis.

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
public class MonthlyRecurrenceRule : RecurrenceRule, ISerializable, IEquatable<RecurrenceRule>

Inheritance: objectRecurrenceRuleMonthlyRecurrenceRule

Implements: IEquatable<RecurrenceRule>ISerializable

Inherited Members RecurrenceRule.rulePatternRecurrenceRule.ruleRangeRecurrenceRule.EmptyRecurrenceRule.FromPatternAndRange(RecurrencePattern, RecurrenceRange)RecurrenceRule.TryParse(string, out RecurrenceRule)RecurrenceRule.TryParse(string)RecurrenceRule.TryParse(string, string, out RecurrenceRule)RecurrenceRule.IsValidValue<T>(T, T, T)RecurrenceRule.ValidateValue<T>(string, T, T, T)RecurrenceRule.SetEffectiveRange(DateTime, DateTime)RecurrenceRule.ClearEffectiveRange()RecurrenceRule.ToString()RecurrenceRule.ToString(TimeZoneInfoProvider)RecurrenceRule.GetHashCode()RecurrenceRule.Equals(object)RecurrenceRule.Equals(RecurrenceRule)RecurrenceRule.MatchDayOfWeekMask(DateTime)RecurrenceRule.MatchDayOrdinal(DateTime)RecurrenceRule.GetObjectData(SerializationInfo, StreamingContext)RecurrenceRule.RangeRecurrenceRule.PatternRecurrenceRule.OccurrencesRecurrenceRule.HasOccurrencesRecurrenceRule.ExceptionsRecurrenceRule.HasExceptionsRecurrenceRule.MaximumCandidatesRecurrenceRule.EffectiveStartobject.Equals(object, object)object.ReferenceEquals(object, object)object.GetType()object.MemberwiseClone()...

Example:

csharp
using System;
using Telerik.Web.UI;

namespace RecurrenceExamples
{
    class MonthlyRecurrenceRuleExample1
    {
        static void Main()
        {
            // Creates a sample appointment that starts at 6/1/2007 3:30 PM (local time) 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 = 5;

            // Creates a recurrence rule to repeat the appointment on the 5th day of every month.
            MonthlyRecurrenceRule rrule = new MonthlyRecurrenceRule(5, 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/5/2007 3:30:00 PM
 2: 7/5/2007 3:30:00 PM
 3: 8/5/2007 3:30:00 PM
 4: 9/5/2007 3:30:00 PM
 5: 10/5/2007 3:30:00 PM
*/
csharp
Imports System
Imports Telerik.Web.UI

Namespace RecurrenceExamples
    Class MonthlyRecurrenceRuleExample1
        Shared Sub Main()
            ' Creates a sample appointment that starts at 6/1/2007 3:30 PM (local time) 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 = 5

            ' Creates a recurrence rule to repeat the appointment on the 5th day of every month.
            Dim rrule As New MonthlyRecurrenceRule(5, 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/5/2007 3:30:00 PM
' 2: 7/5/2007 3:30:00 PM
' 3: 8/5/2007 3:30:00 PM
' 4: 9/5/2007 3:30:00 PM
' 5: 10/5/2007 3:30:00 PM
'

Constructors

Initializes a new instance of the MonthlyRecurrenceRule class.

C#
public MonthlyRecurrenceRule(int dayOfMonth, int interval, RecurrenceRange range)
Parameters:dayOfMonthint

The day of month on which the event recurs.

intervalint

The interval (in months) between the occurrences.

rangeRecurrenceRange

The RecurrenceRange instance that specifies the range of this rule.

Example:
cs-api-definition
using System;
using Telerik.Web.UI;

namespace RecurrenceExamples
{
class MonthlyRecurrenceRuleExample1
{
static void Main()
{
// Creates a sample appointment that starts at 6/1/2007 3:30 PM (local time) 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 = 5;

// Creates a recurrence rule to repeat the appointment on the 5th day of every month.
MonthlyRecurrenceRule rrule = new MonthlyRecurrenceRule(5, 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/5/2007 3:30:00 PM
2: 7/5/2007 3:30:00 PM
3: 8/5/2007 3:30:00 PM
4: 9/5/2007 3:30:00 PM
5: 10/5/2007 3:30:00 PM
*/

Initializes a new instance of the MonthlyRecurrenceRule class.

C#
public MonthlyRecurrenceRule(int dayOrdinal, RecurrenceDay daysOfWeekMask, int interval, RecurrenceRange range)
Parameters:dayOrdinalint

The day ordinal modifier. See DayOrdinal for additional information.

daysOfWeekMaskRecurrenceDay

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

intervalint

The interval (in months) between the occurrences.

rangeRecurrenceRange

The RecurrenceRange instance that specifies the range of this rule.

Example:
cs-api-definition
using System;
using Telerik.Web.UI;

namespace RecurrenceExamples
{
class MonthlyRecurrenceRuleExample2
{
static void Main()
{
// Creates a sample appointment that starts at 6/1/2007 3:30 PM (local time) 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 = 5;

// Creates a recurrence rule to repeat the appointment on the last monday of every two months.
MonthlyRecurrenceRule rrule = new MonthlyRecurrenceRule(-1, RecurrenceDay.Monday, 2, 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/25/2007 3:30:00 PM
2: 8/27/2007 3:30:00 PM
3: 10/29/2007 2:30:00 PM
4: 12/31/2007 2:30:00 PM
5: 2/25/2008 2:30:00 PM
*/

Properties

Gets the day of month on which the event recurs.

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

The day of month on which the event recurs.

Gets the day ordinal modifier. See DayOrdinal for additional information.

C#
public int DayOrdinal { get; }
Property Value:

The day ordinal modifier.

Gets the interval (in months) between the occurrences.

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

The interval (in months) between the occurrences.

Gets the month in which the event recurs.

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

The month in which the event recurs.

Methods

C#
protected override DateTime GetOccurrenceStart(int index)
Parameters:indexintReturns:

DateTime

Overrides: RecurrenceRule.GetOccurrenceStart(int)

C#
protected override bool MatchAdvancedPattern(DateTime start)
Parameters:startDateTimeReturns:

bool

Overrides: RecurrenceRule.MatchAdvancedPattern(DateTime)