RecurrenceRuleExtensions Class
public static class RecurrenceRuleExtensionsNo documentation is available.
Methods
| Name | Description |
|---|---|
| GetNextOccurrence(IRecurrenceRule, DateTime) | Gets the next occurrence of the recurrence starting from the specified date. |
| GetNextOccurrence(IRecurrenceRule, DateTime, string) | Gets the next occurrence of the recurrence, reading startDate as a wall-clock time in the specified time zone. |
| GetNextOccurrence(IRecurrenceRule, DateTime, TimeZoneInfo) | Gets the next occurrence of the recurrence, reading startDate as a wall-clock time in timeZone. |
| GetNextOccurrence(IRecurrenceRule, DateTimeOffset) | Gets the next occurrence of the recurrence starting from the specified date. |
| GetNextOccurrence(IRecurrenceRule, DateTimeOffset, string) | Gets the next occurrence of the recurrence, starting from the instant startDate denotes. |
| GetNextOccurrence(IRecurrenceRule, DateTimeOffset, TimeZoneInfo) | Gets the next occurrence of the recurrence, starting from the instant startDate denotes. |
| GetNextOccurrences(IRecurrenceRule, DateTime, string) | Gets all occurrences of the recurrence, reading startDate as a wall-clock time in the specified time zone. |
| GetNextOccurrences(IRecurrenceRule, DateTime, TimeZoneInfo) | Gets all occurrences of the recurrence, reading startDate as a wall-clock time in timeZone. |
| GetNextOccurrences(IRecurrenceRule, DateTimeOffset, string) | Gets all occurrences of the recurrence, starting from the instant startDate denotes. |
| GetNextOccurrences(IRecurrenceRule, DateTimeOffset, TimeZoneInfo) | Gets all occurrences of the recurrence, starting from the instant startDate denotes. |
GetNextOccurrence overloads
GetNextOccurrence(IRecurrenceRule, DateTime)
RecurrenceRuleExtensions.csGets the next occurrence of the recurrence starting from the specified date.
public static DateTime? GetNextOccurrence(this IRecurrenceRule recurrenceRule, DateTime startDate)Parameters
recurrenceRuleIRecurrenceRulestartDateDateTime- The date to start searching for the next occurrence.
Returns
DateTime? The next occurrence date, or null if there are no more occurrences.
GetNextOccurrence(IRecurrenceRule, DateTime, string)
RecurrenceRuleExtensions.csGets the next occurrence of the recurrence, reading startDate as a wall-clock time in the specified time zone.
public static DateTimeOffset? GetNextOccurrence(this IRecurrenceRule recurrenceRule, DateTime startDate, string timeZoneId)Parameters
recurrenceRuleIRecurrenceRulestartDateDateTime- The wall-clock time to start searching from. Its
DateTime.Kindis ignored. timeZoneIdstring- The identifier of the time zone the recurrence is expressed in.
Returns
DateTimeOffset? The next occurrence with the UTC offset in effect at that occurrence, or null if there are no more occurrences.
Exceptions
TimeZoneNotFoundException- No time zone matches
timeZoneId.
Remarks
On .NET Framework the runtime provides no conversion between IANA and Windows identifiers, so an IANA identifier such as America/New_York does not resolve on Windows. Resolve the TimeZoneInfo there and use the overload that takes one.
GetNextOccurrence(IRecurrenceRule, DateTime, TimeZoneInfo)
RecurrenceRuleExtensions.csGets the next occurrence of the recurrence, reading startDate as a wall-clock time in timeZone.
public static DateTimeOffset? GetNextOccurrence(this IRecurrenceRule recurrenceRule, DateTime startDate, TimeZoneInfo timeZone)Parameters
recurrenceRuleIRecurrenceRulestartDateDateTime- The wall-clock time to start searching from. Its
DateTime.Kindis ignored. timeZoneTimeZoneInfo- The time zone the recurrence is expressed in.
Returns
DateTimeOffset? The next occurrence with the UTC offset in effect at that occurrence, or null if there are no more occurrences.
GetNextOccurrence(IRecurrenceRule, DateTimeOffset)
RecurrenceRuleExtensions.csGets the next occurrence of the recurrence starting from the specified date.
public static DateTimeOffset? GetNextOccurrence(this IRecurrenceRule recurrenceRule, DateTimeOffset startDate)Parameters
recurrenceRuleIRecurrenceRulestartDateDateTimeOffset- The date to start searching for the next occurrence.
Returns
DateTimeOffset? The next occurrence date with the same offset as startDate, or null if there are no more occurrences.
Remarks
The occurrences are computed using the local time of startDate, and the offset of startDate is applied to the result. The offset is therefore the same for every occurrence; use an overload that takes a TimeZoneInfo to follow daylight saving transitions. A UTC or local RecurrenceRule.EndDate denotes an instant and bounds the occurrences by instant.
GetNextOccurrence(IRecurrenceRule, DateTimeOffset, string)
RecurrenceRuleExtensions.csGets the next occurrence of the recurrence, starting from the instant startDate denotes.
public static DateTimeOffset? GetNextOccurrence(this IRecurrenceRule recurrenceRule, DateTimeOffset startDate, string timeZoneId)Parameters
recurrenceRuleIRecurrenceRulestartDateDateTimeOffset- The instant to start searching from. It is reduced to a wall-clock time in the specified time zone.
timeZoneIdstring- The identifier of the time zone the recurrence is expressed in.
Returns
DateTimeOffset? The next occurrence with the UTC offset in effect at that occurrence, or null if there are no more occurrences.
Exceptions
TimeZoneNotFoundException- No time zone matches
timeZoneId.
Remarks
On .NET Framework the runtime provides no conversion between IANA and Windows identifiers, so an IANA identifier such as America/New_York does not resolve on Windows. Resolve the TimeZoneInfo there and use the overload that takes one.
GetNextOccurrence(IRecurrenceRule, DateTimeOffset, TimeZoneInfo)
RecurrenceRuleExtensions.csGets the next occurrence of the recurrence, starting from the instant startDate denotes.
public static DateTimeOffset? GetNextOccurrence(this IRecurrenceRule recurrenceRule, DateTimeOffset startDate, TimeZoneInfo timeZone)Parameters
recurrenceRuleIRecurrenceRulestartDateDateTimeOffset- The instant to start searching from. It is reduced to a wall-clock time in
timeZone. timeZoneTimeZoneInfo- The time zone the recurrence is expressed in.
Returns
DateTimeOffset? The next occurrence with the UTC offset in effect at that occurrence, or null if there are no more occurrences.
GetNextOccurrences overloads
GetNextOccurrences(IRecurrenceRule, DateTime, string)
RecurrenceRuleExtensions.csGets all occurrences of the recurrence, reading startDate as a wall-clock time in the specified time zone.
public static IEnumerable<DateTimeOffset> GetNextOccurrences(this IRecurrenceRule recurrenceRule, DateTime startDate, string timeZoneId)Parameters
recurrenceRuleIRecurrenceRulestartDateDateTime- The wall-clock time to start generating occurrences from. Its
DateTime.Kindis ignored. timeZoneIdstring- The identifier of the time zone the recurrence is expressed in.
Returns
IEnumerable<DateTimeOffset> An enumerable sequence of occurrences, each carrying the UTC offset in effect at that occurrence.
Exceptions
TimeZoneNotFoundException- No time zone matches
timeZoneId.
Remarks
On .NET Framework the runtime provides no conversion between IANA and Windows identifiers, so an IANA identifier such as America/New_York does not resolve on Windows. Resolve the TimeZoneInfo there and use the overload that takes one.
GetNextOccurrences(IRecurrenceRule, DateTime, TimeZoneInfo)
RecurrenceRuleExtensions.csGets all occurrences of the recurrence, reading startDate as a wall-clock time in timeZone.
public static IEnumerable<DateTimeOffset> GetNextOccurrences(this IRecurrenceRule recurrenceRule, DateTime startDate, TimeZoneInfo timeZone)Parameters
recurrenceRuleIRecurrenceRulestartDateDateTime- The wall-clock time to start generating occurrences from. Its
DateTime.Kindis ignored. timeZoneTimeZoneInfo- The time zone the recurrence is expressed in.
Returns
IEnumerable<DateTimeOffset> An enumerable sequence of occurrences, each carrying the UTC offset in effect at that occurrence.
GetNextOccurrences(IRecurrenceRule, DateTimeOffset, string)
RecurrenceRuleExtensions.csGets all occurrences of the recurrence, starting from the instant startDate denotes.
public static IEnumerable<DateTimeOffset> GetNextOccurrences(this IRecurrenceRule recurrenceRule, DateTimeOffset startDate, string timeZoneId)Parameters
recurrenceRuleIRecurrenceRulestartDateDateTimeOffset- The instant to start generating occurrences from. It is reduced to a wall-clock time in the specified time zone.
timeZoneIdstring- The identifier of the time zone the recurrence is expressed in.
Returns
IEnumerable<DateTimeOffset> An enumerable sequence of occurrences, each carrying the UTC offset in effect at that occurrence.
Exceptions
TimeZoneNotFoundException- No time zone matches
timeZoneId.
Remarks
On .NET Framework the runtime provides no conversion between IANA and Windows identifiers, so an IANA identifier such as America/New_York does not resolve on Windows. Resolve the TimeZoneInfo there and use the overload that takes one.
GetNextOccurrences(IRecurrenceRule, DateTimeOffset, TimeZoneInfo)
RecurrenceRuleExtensions.csGets all occurrences of the recurrence, starting from the instant startDate denotes.
public static IEnumerable<DateTimeOffset> GetNextOccurrences(this IRecurrenceRule recurrenceRule, DateTimeOffset startDate, TimeZoneInfo timeZone)Parameters
recurrenceRuleIRecurrenceRulestartDateDateTimeOffset- The instant to start generating occurrences from. It is reduced to a wall-clock time in
timeZone. timeZoneTimeZoneInfo- The time zone the recurrence is expressed in.
Returns
IEnumerable<DateTimeOffset> An enumerable sequence of occurrences, each carrying the UTC offset in effect at that occurrence.
Remarks
No occurrence before startDate is returned, even when the wall-clock time it is reduced to is in the hour repeated by a backward transition, whose first reading is what RFC 5545 section 3.3.5 means.