In This Article

DayOfWeekExtensions Class

Provides extension methods for the type DayOfWeek.

public static class DayOfWeekExtensions
Inheritance:
object object

Methods

IsWeekend(DayOfWeek)

Returns whether the specified DayOfWeek is on a weekend.

public static bool IsWeekend(this DayOfWeek dayOfWeek)
Parameter Type Description
dayOfWeek DayOfWeek

The DayOfWeek to examine.

Returns

bool:

true if the specified DayOfWeek is on a weekend; otherwise, false.

ToString(DayOfWeek, DayOfWeekFormatPattern)

Converts the value of a DayOfWeek object to its equivalent string representation using the specified format.

public static string ToString(this DayOfWeek dayOfWeek, DayOfWeekFormatPattern pattern)
Parameter Type Description
dayOfWeek DayOfWeek

The DayOfWeek to convert.

pattern DayOfWeekFormatPattern

A DayOfWeekFormatPattern specifying the conversion format to use.

Returns

string:

The string representation of the DayOfWeek.

ToString(DayOfWeek, DayOfWeekFormatPattern, IFormatProvider)

Converts the value of a DayOfWeek object to its equivalent string representation using the specified format and culture-specific format information.

public static string ToString(this DayOfWeek dayOfWeek, DayOfWeekFormatPattern pattern, IFormatProvider provider)
Parameter Type Description
dayOfWeek DayOfWeek

The DayOfWeek to convert.

pattern DayOfWeekFormatPattern

A DayOfWeekFormatPattern specifying the conversion format to use.

provider IFormatProvider

An IFormatProvider that supplies culture-specific formatting information.

Returns

string:

The string representation of the DayOfWeek.

Inherited Members