The requested page is not available for the requested platform. You are viewing the content for Default platform.

Add Missing Case Statements

Adds case statements for all uncovered cases to the current switch statement.

Availability

From the context menus or via shortcuts:

  • when the edit cursor or caret is on a switch statement, provided that this switch statement does not cover all available enumeration cases.

Example

switch (DateTime.Now.DayOfWeek)
{
  case DayOfWeek.Monday:
    TodaySchedule = MonSchedule;
    break;
  case DayOfWeek.Tuesday:
    TodaySchedule = TueSchedule;
    break;
  case DayOfWeek.Wednesday:
    TodaySchedule = WedSchedule;
    break;
  case DayOfWeek.Thursday:
    TodaySchedule = ThuSchedule;
    break;
  case DayOfWeek.Friday:
    TodaySchedule = FriSchedule;
    break;
}
Select Case DateTime.Now.DayOfWeek
  Case DayOfWeek.Monday
    TodaySchedule = MonSchedule

  Case DayOfWeek.Tuesday
    TodaySchedule = TueSchedule

  Case DayOfWeek.Wednesday
    TodaySchedule = WedSchedule

  Case DayOfWeek.Thursday
    TodaySchedule = ThuSchedule

  Case DayOfWeek.Friday
    TodaySchedule = FriSchedule
End Select

Result:

switch (DateTime.Now.DayOfWeek)
{
  case DayOfWeek.Monday:
    TodaySchedule = MonSchedule;
    break;
  case DayOfWeek.Tuesday:
    TodaySchedule = TueSchedule;
    break;
  case DayOfWeek.Wednesday:
    TodaySchedule = WedSchedule;
    break;
  case DayOfWeek.Thursday:
    TodaySchedule = ThuSchedule;
    break;
  case DayOfWeek.Friday:
    TodaySchedule = FriSchedule;
    break;
  case DayOfWeek.Sunday:
    break;
  case DayOfWeek.Saturday:
    break;
}
Select Case DateTime.Now.DayOfWeek
  Case DayOfWeek.Monday
    TodaySchedule = MonSchedule

  Case DayOfWeek.Tuesday
    TodaySchedule = TueSchedule

  Case DayOfWeek.Wednesday
    TodaySchedule = WedSchedule

  Case DayOfWeek.Thursday
    TodaySchedule = ThuSchedule

  Case DayOfWeek.Friday
    TodaySchedule = FriSchedule

  Case DayOfWeek.Sunday

  Case DayOfWeek.Saturday
End Select