2

Does anyone know of a shortcut, preferably an extension, or some other way to easily navigate cases in a switch statement?

I often find myself wanting a popup, window, or something to show which cases are handled in a switch statement, jump to them, etc. It would be extremely handy, especially with large switch statements.

It would be nice to refactor some of the larger ones into a better design, but even with smaller ones, it would be nice to have this ability.

Joshjje
  • 220
  • 4
  • 14

1 Answers1

1

There are two things which can be done, but it requires refactoring to be done by hand.

  1. Extract the code to a methods for each case statement and be consistent in the naming each methods. That will make it easier to navigate to the process via Visual Studio's go to method name on the upper right hand side of the editor.
  2. Put in named regions around each of the case statements. That way one can collapse all case statements easily and the names which define the regions can be searched against; again if named consistently.
ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122