public static void Run() { Timer.RecordMiliseconds(() => { var day = new CalendarDay(DayOfWeek.Tuesday, 1901, Month.January, 1); //var day = new CalendarDay(DayOfWeek.Saturday, 1904, Month.February, 28); int sundayCount = 0; do { //Console.WriteLine(day); if (day.DayOfWeek == DayOfWeek.Sunday && day.DayOfMonth == 1) { sundayCount++; } day = day.NextDay(); } while (day.Year < 2001); Console.WriteLine("The 20th century had {0} sundays that fell on the first of the month", sundayCount); }); }
public static void Run() { Timer.RecordMiliseconds(() => { var day = new CalendarDay(DayOfWeek.Tuesday, 1901, Month.January, 1); //var day = new CalendarDay(DayOfWeek.Saturday, 1904, Month.February, 28); int sundayCount = 0; do { //Console.WriteLine(day); if (day.DayOfWeek == DayOfWeek.Sunday && day.DayOfMonth == 1) sundayCount++; day = day.NextDay(); } while (day.Year < 2001); Console.WriteLine("The 20th century had {0} sundays that fell on the first of the month", sundayCount); }); }
public CalendarDayGenerator(CalendarDay firstDayToGenerate) { _firstDayToGenerate = firstDayToGenerate; }