Table of Contents

Class DayOfWeekExtensions

Namespace
Garyon.Extensions
Assembly
Garyon.dll

Provides extensions for the DayOfWeek enum.

public static class DayOfWeekExtensions
Inheritance
DayOfWeekExtensions
Inherited Members

Methods

DaysSinceWeekStart(DayOfWeek, DayOfWeek)

Gets the number of days since the week start.

public static int DaysSinceWeekStart(this DayOfWeek currentDay, DayOfWeek weekStart)

Parameters

currentDay DayOfWeek

The current day in the week.

weekStart DayOfWeek

The starting day of the week.

Returns

int

The number of days since the first day in the week, according to weekStart.

IsWeekday(DayOfWeek)

Determines whether the given DayOfWeek represents a weekday, between Monday and Friday.

[ExcludeFromCodeCoverage]
public static bool IsWeekday(this DayOfWeek day)

Parameters

day DayOfWeek

The DayOfWeek to determine if it's a weekday.

Returns

bool

true if the value is between Monday and Friday, inclusive, otherwise false.

IsWeekend(DayOfWeek)

Determines whether the given DayOfWeek represents a weekend day, which is Saturday or Sunday.

[ExcludeFromCodeCoverage]
public static bool IsWeekend(this DayOfWeek day)

Parameters

day DayOfWeek

The DayOfWeek to determine if it's a weekend day.

Returns

bool

true if the value is either Saturday or Sunday, otherwise false.

ShiftRegardingStartingWeekDay(DayOfWeek, DayOfWeek)

Shifts the given DayOfWeek to another, regarding the new starting day of week.

public static DayOfWeek ShiftRegardingStartingWeekDay(this DayOfWeek value, DayOfWeek starting)

Parameters

value DayOfWeek

The DayOfWeek to shift.

starting DayOfWeek

The new starting DayOfWeek.

Returns

DayOfWeek

The DayOfWeek whose offset from starting is the same offset from Sunday.