static void Main(string[] args) { DateTime[] holidays = { new DateTime(2020, 8, 24) }; DateTime start = new DateTime(2020, 8, 5); DateTime end = new DateTime(2020, 8, 26); WriteLine($"Count of working days: {CountWorkingDays(start, end, holidays)}, without structure."); PeriodRange range = new PeriodRange { Start = new DateTime(2020, 8, 5), End = new DateTime(2020, 8, 26) }; WriteLine($"Count of working days: {CountWorkingDays(range, holidays)}, with structure."); }
static int CountWorkingDays(PeriodRange period, DateTime[] holidays = null) { return(CountWorkingDays(period.Start, period.End, holidays)); }