.NET API Docs

System.DayOfWeek Enum

The System.DayOfWeek enumeration represents the days of the week.

Namespace

System

Assembly

System.Runtime.dll

Members

NameValueDescription
Sunday0Represents Sunday.
Monday1Represents Monday.
Tuesday2Represents Tuesday.
Wednesday3Represents Wednesday.
Thursday4Represents Thursday.
Friday5Represents Friday.
Saturday6Represents Saturday.

Example

// Print all days of the week
foreach (System.DayOfWeek day in System.Enum.GetValues(typeof(System.DayOfWeek)))
{
    Console.WriteLine($"{(int)day} - {day}");
}

// Convert numeric input to DayOfWeek
int userInput = 3;
System.DayOfWeek result = (System.DayOfWeek)userInput;
Console.WriteLine($"The day for value {userInput} is {result}.");

Interactive Demo