In a month i want to know mondays to sataurdays for the current month eg: in oct month 2011 there are
3-oct-2011 to 8-oct-2011,
10-OCt-11 to 15-Oct-11,
Efficient solution;
var x = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
int i = 1;
while (i <= x)
{
if (new DateTime(DateTime.Now.Year, DateTime.Now.Month, i).DayOfWeek == DayOfWeek.Saturday)
{
Console.WriteLine(new DateTime(DateTime.Now.Year, DateTime.Now.Month, i));
i += 6;
}
i++;
}