protected IEnumerable <DateInterval> EnumIntervals() { var intervals = Interval.EnumMonths().ToArray(); for (int i = (intervals.Length - 1) % GroupMonths + 1 - GroupMonths; i < intervals.Length; i += GroupMonths) { yield return(new DateInterval(intervals[Math.Max(0, i)].Start, intervals[i + GroupMonths - 1].End)); } }