- 314 名前:デフォルトの名無しさん mailto:sage [2009/02/06(金) 00:46:17 ]
- > ArrayList型の配列
ほんとうに・・・? // LINQつかってまう using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var listDay = eachDay(new DateTime(2009, 1, 1), new DateTime(2009, 1, 5)).ToList(); listDay.ForEach(x => Console.WriteLine(x.ToShortDateString())); Console.WriteLine(listDay.Count); Console.Read(); } private static IEnumerable<DateTime> eachDay(DateTime begin, DateTime end) { for (DateTime tmp = begin; tmp <= end; tmp = tmp.AddDays(1)) { yield return tmp; } yield break; } } }
|

|