В С#, учитывая произвольный набор конечных точек DayOfWeek (например, DayOfWeek.Friday и DayOfWeek.Sunday), как бы проверить, если между этими двумя днями включится произвольная дата?
Пример:
// result == true; Oct 23, 2010 is a Saturday
var result = InBetweenDaysInclusive(new DateTime(2010, 10, 23),
DayOfWeek.Friday,
DayOfWeek.Sunday);
// result == true; Oct 22, 2010 is a Friday
result = InBetweenDaysInclusive(new DateTime(2010, 10, 22),
DayOfWeek.Friday,
DayOfWeek.Sunday);
// result == true; Oct 24, 2010 is a Sunday
result = InBetweenDaysInclusive(new DateTime(2010, 10, 24),
DayOfWeek.Friday,
DayOfWeek.Sunday);
// result == false; Oct 25, 2010 is a Monday
result = InBetweenDaysInclusive(new DateTime(2010, 10, 25),
DayOfWeek.Friday,
DayOfWeek.Sunday);
Спасибо!