寻找 linq 查询以用月份 + 年份填充列表,例如(2012 年 1 月)
从当月开始
var currentdate = System.DateTime.Now
如果 2011 年 12 月是当前月份 那么列表应该是这样的
2011 年 12 月 2012 年 1 月 …… 2012 年 11 月
最佳答案
var months =
Enumerable.Range(0, 12).
Select(n => DateTime.Today.AddMonths(n)).
Select(d = new { Year = d.Year, Month = d.Month });
关于c# - 全年的月份+年份的Linq列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8560134/