IWeekendDefinitionProviderExtensions Class
Definition
Provides conversions from IWeekendDefinitionProvider to the canonical DayOfWeekSet value type used by the working-week APIs.
public static class IWeekendDefinitionProviderExtensions
- Inheritance
-
IWeekendDefinitionProviderExtensions
- Inherited Members
Methods
ToWorkingWeek(IWeekendDefinitionProvider)
Returns the working week an IWeekendDefinitionProvider implies: the DayOfWeekSet of the days that are not weekend days.
public static DayOfWeekSet ToWorkingWeek(this IWeekendDefinitionProvider provider)
Parameters
providerIWeekendDefinitionProviderThe provider whose weekend the working week complements.
Returns
- DayOfWeekSet
The days
providerdoes not count as weekend days.
Remarks
The provider is asked about each of the seven days once. Use the result with APIs that take a working week as a DayOfWeekSet, such as IsInWorkingWeek(DateOnly, DayOfWeekSet); they test one bit per day and never consult the provider again.
IWeekendDefinitionProvider provider = new FridaySaturdayWeekend();
DayOfWeekSet workingWeek = provider.ToWorkingWeek(); // Sunday to Thursday
bool working = new DateOnly(2026, 10, 8).IsInWorkingWeek(workingWeek); // true, a Thursday
Exceptions
- ArgumentNullException
Thrown when
provideris null.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |