Search code examples
visual-studiovisual-studio-2010keyboard-shortcutsswitch-statement

Shortcut in Visual Studio 2010 to generate all possible Case's in Switch


I can't find key binding to expand all possible cases in switch, eg. have switch with enum argument, in Borland C++ i doing this with TAB key while switch code is selected.

I want to do this in Visual Studio 2010.

Can anyone help me?


Solution

  • It C++ it's not possible to do this. The IDE just doesn't have support for that operation.

    In C# you can do this with the switch code snippet:

    • Type "switch" in the IDE which will select the snippet in intellisense
    • Hit Tab to insert the snippet which will move the cursor inside the parens
    • Type the expression to switch on and hit Enter

    This will expand out the known cases into the IDE.