private static uint GetOccurrenceCount(DateTime start, DateTime endBy, string rrule)
{
// ExStart:GetOccurrenceCountMonthlyEndAfterNoccurrences
CalendarRecurrence pattern = new CalendarRecurrence(string.Format("DTSTART:{0}\r\nRRULE:{1}", start.ToString("yyyyMMdd"), rrule));
DateCollection dates = pattern.GenerateOccurrences(start, endBy);
return (uint)dates.Count;
// ExEnd:GetOccurrenceCountMonthlyEndAfterNoccurrences
}
}