我试图获得接下来的五个工作日,但我被困住了。
我是这样开始的:
List<DateTime> allWeekEndsInOneYear = new List<DateTime>();
DateTime sDate = DateTime.Now;
DateTime eDate = DateTime.Now.AddYears(1);
TimeSpan diff = eDate - sDate;
int days = diff.Days;
for (var i = 0; i <= days; i++)
{
var testDate = sDate.AddDays(i);
switch (testDate.DayOfWeek)
{
case DayOfWeek.Saturday:
case DayOfWeek.Sunday:
allWeekEndsInOneYear.Add(testDate);
break;
}
}
List<DateTime> daysToMark = new List<DateTime>();
DateTime startDate = DateTime.Now;
DateTime endDate = DateTime.Now.AddDays(5);
现在我需要用接下来的 5 天填写 daysToMark,不包括周数(allWeekEndsInOneYear 中的那些)。非常感谢任何帮助。