Getting the NEXT occurrence

Hi.

I am trying to use the iCalendar to obtain the next datetime in a recurrence pattern.

The pattterns will include DTSTART but will not necessarily include either a count or and enddate and as such they have an infinate range.

I can't call GenerateOccurrences() with no range specified as the result is an out of memory exception due to the infinate number of items in the result.

I want to call GenerateOccurrences(startRange) to get only a single value returned that being the next datetime in the pattern immediately following startRange which will be defined in the code at DateTimeNow

As this overload does not exist, I have to call the method with both a startRange and and endRange. The solution is to provide a range between now and now + 2 years. This sort of works in that as long as that pattern is at least DAILY then the max number of items returned is 800ish, however if the patterns is less than daily then the number of returned items is ever greater.

As I ONLY want to generate the NEXT occurrence is there a better way?

Thanks

Hi,

Thanks for considering Aspose.

GenerateOccurrences() method returns all possible DateTime values according to the specified pattern or date range provided as arguments. If you want to get only single value from GenerateOccurrences() method, you may reduce the date range to 1 or days instead of 2 years.

Please share your code snippet and your requirements details, in case I misunderstood you.