Skip to content

Instantly share code, notes, and snippets.

@brianc
Created May 20, 2010 22:26
Show Gist options
  • Save brianc/408198 to your computer and use it in GitHub Desktop.
Save brianc/408198 to your computer and use it in GitHub Desktop.
private static int GetDayNumber(DayOfWeek dayOfWeek)
{
switch (dayOfWeek)
{
case DayOfWeek.Monday:
return 1;
case DayOfWeek.Tuesday:
return 2;
case DayOfWeek.Wednesday:
return 3;
case DayOfWeek.Thursday:
return 4;
case DayOfWeek.Friday:
return 5;
case DayOfWeek.Saturday:
return 6;
case DayOfWeek.Sunday:
return 7;
}
throw new InvalidOperationException("Another day was added to the week. Life as we know it has ended.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment