Table of Contents

WorkingDaysOfWeekExtensions Class

Definition

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

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

value WorkingDaysOfWeek

The named working week to convert.

Returns

DayOfWeekSet

The DayOfWeekSet whose selected days match value.

Exceptions

ArgumentOutOfRangeException

Thrown when value is not a defined member of the WorkingDaysOfWeek enumeration.

ArgumentException

Thrown when value is 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

value WorkingDaysOfWeek

The named working week to convert.

provider IWeekendDefinitionProvider

A custom weekend provider consulted only when value is Custom.

Returns

DayOfWeekSet

The DayOfWeekSet whose selected days match the working-week implied by value (and provider when applicable).

Exceptions

ArgumentOutOfRangeException

Thrown when value is not a defined member of the WorkingDaysOfWeek enumeration.

ArgumentNullException

Thrown when value is Custom and provider is null.

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

workingWeek DayOfWeekSet

The working week to identify.

Returns

WorkingDaysOfWeek

The WorkingDaysOfWeek whose canonical set equals workingWeek, or Custom when workingWeek does 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

workingWeek DayOfWeekSet

The working week to identify.

value WorkingDaysOfWeek

When this method returns true, contains the matching WorkingDaysOfWeek; otherwise, Custom.

Returns

bool

true when workingWeek matches a named preset; otherwise false.

Applies to

ProductVersions
.NET8, 10