// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace E { public class Program { public static void Count(DateTime start) { int wd = 0; int sa = 0; int su = 0; DateTime curr = start; while(curr.Month == start.Month) { switch(curr.DayOfWeek) { case DayOfWeek.Monday: case DayOfWeek.Tuesday: case DayOfWeek.Wednesday: case DayOfWeek.Thursday: case DayOfWeek.Friday: wd++; break; case DayOfWeek.Saturday: sa++; break; case DayOfWeek.Sunday: su++; break; } curr = curr.AddDays(1); } Console.WriteLine(wd + " " + sa + " " + su); } public static void Main(string[] args) { Count(new DateTime(2013, 1, 1)); } } }