Accepted answer

I'm editing to turn my sample code into a method that I might almost use in production because it's more testable and culture-aware:

public IEnumerable GetMonths(DateTime currentDate, IFormatProvider provider)
    return from i in Enumerable.Range(0, 12)
           let now = currentDate.AddMonths(i)
           select new
               MonthLabel = now.ToString("MMMM", provider),
               Month = now.Month,
               Year = now.Year

This outputs (on a French computer):

LINQPad Output


var months = 
    Enumerable.Range(0, 12).
    Select(n => DateTime.Today.AddMonths(n)).
    Select(d = new { Year = d.Year, Month = d.Month });

Related Articles