I have a list containing 60 DateTime objects (sorted in ascending order) and need to validate that each date is 1 month greater than the previous one in the list.
For example, the following list of dates would be valid because they increment by one month with none missing:
Jan-2009
Feb-2009
Mar-2009
Apr-2009
However, the following list of dates would be invalid because Feb-2009 is missing:
Jan-2009
Mar-2009
Apr-2009
The day doesn't matter, just the month and year are considered.
Is there an efficient/pretty way of doing this?