WorkingDaysOfWeekExtensions Class
Definition
Provides bidirectional conversion between the WorkingDaysOfWeek enum sugar and the DayOfWeekSet value type.
public static class WorkingDaysOfWeekExtensions
- Inheritance
-
WorkingDaysOfWeekExtensions
- Inherited Members
Methods
ToDayOfWeekSet(WorkingDaysOfWeek)
Returns the canonical DayOfWeekSet for the supplied WorkingDaysOfWeek value.
public static DayOfWeekSet ToDayOfWeekSet(this WorkingDaysOfWeek value)
Parameters
valueWorkingDaysOfWeekThe named working week to convert.
Returns
- DayOfWeekSet
The DayOfWeekSet whose selected days match
value.
Exceptions
- ArgumentOutOfRangeException
Thrown when
valueis not a defined member of the WorkingDaysOfWeek enumeration.- ArgumentException
Thrown when
valueis Custom, which has no canonical set.
ToDayOfWeekSet(WorkingDaysOfWeek, IWeekendDefinitionProvider?)
Returns the canonical DayOfWeekSet for the supplied WorkingDaysOfWeek value,
consulting provider when value is
Custom.
public static DayOfWeekSet ToDayOfWeekSet(this WorkingDaysOfWeek value, IWeekendDefinitionProvider? provider)
Parameters
valueWorkingDaysOfWeekThe named working week to convert.
providerIWeekendDefinitionProviderA custom weekend provider consulted only when
valueis Custom.
Returns
- DayOfWeekSet
The DayOfWeekSet whose selected days match the working-week implied by
value(andproviderwhen applicable).
Exceptions
- ArgumentOutOfRangeException
Thrown when
valueis not a defined member of the WorkingDaysOfWeek enumeration.- ArgumentNullException
ToWorkingDaysOfWeek(DayOfWeekSet)
Returns the matching WorkingDaysOfWeek value for the supplied DayOfWeekSet, or Custom when no named preset matches.
public static WorkingDaysOfWeek ToWorkingDaysOfWeek(this DayOfWeekSet workingWeek)
Parameters
workingWeekDayOfWeekSetThe working week to identify.
Returns
- WorkingDaysOfWeek
The WorkingDaysOfWeek whose canonical set equals
workingWeek, or Custom whenworkingWeekdoes not match any named preset.
TryGetWorkingDaysOfWeek(DayOfWeekSet, out WorkingDaysOfWeek)
Attempts to identify the supplied DayOfWeekSet as a named WorkingDaysOfWeek preset.
public static bool TryGetWorkingDaysOfWeek(this DayOfWeekSet workingWeek, out WorkingDaysOfWeek value)
Parameters
workingWeekDayOfWeekSetThe working week to identify.
valueWorkingDaysOfWeekWhen this method returns true, contains the matching WorkingDaysOfWeek; otherwise, Custom.
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |