Table of Contents

IWeekendDefinitionProviderExtensions Class

Definition

Namespace
Bodu.Extensions
Assembly
Bodu.Core.dll
Package
Bodu.Core 1.3.0
Source
IWeekendDefinitionProviderExtensions.cs

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

provider IWeekendDefinitionProvider

The provider whose weekend the working week complements.

Returns

DayOfWeekSet

The days provider does 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 provider is null.

Applies to

ProductVersions
.NET8, 10