pinzolo #7028(2008/08/07 01:15 GMT) [ C# ] Rating3/3=1.00
LINQのみ。 もうちょっと書きようがあるかなぁ?
1 2 3 4 5 6 7 8 9 10 11 12
DateTime today = DateTime.Now.Date; var q = from year in Enumerable.Range(today.Year, 2014 - today.Year) from month in Enumerable.Range(1, 12) let d = new DateTime(year, month, 13) where (d.DayOfWeek == DayOfWeek.Friday) && (d >= today) select d; foreach (DateTime d in q) { Console.WriteLine("{0:yyyy/MM/dd(ddd)}", d); } Console.WriteLine(q.Count()); }
Rating3/3=1.00-0+
1 reply [ reply ]
pinzolo #7028() [ C# ] Rating3/3=1.00
LINQのみ。 もうちょっと書きようがあるかなぁ?
Rating3/3=1.00-0+
1 reply [ reply ]