Utilities

Get Business Days from a Date


public static IEnumerable<int> GetBusinessDays()
{
var weekends = new[] { DayOfWeek.Saturday, DayOfWeek.Sunday };
var calendarMonth = DateTime.Now;
var totalDays = DateTime.DaysInMonth(DateTime.Now.Year, calendarMonth.Month);
var businessDays = Enumerable.Range(1, totalDays).Where(d =>!weekends.Contains(new DateTime(DateTime.Now.Year, calendarMonth.Month, d).DayOfWeek));
return businessDays;
}