logo

,

Visual Studio Keyboard Shortcuts You Didn’t Know

To save time in your coding, it’s important to learn the shortcuts for your text editor and programming language of choice, especially if you spend most of your time in an IDE like Visual Studio. Here are a few helpful Visual Studio keyboard shortcuts to get you started. Note that these may differ slightly depending on which version of Visual Studio you’re using, but they’re generally quite similar between major versions as well. Consult your Visual Studio documentation or the internet if you don’t find what you need here. Most of these apply to C# and Visual Basic as well, unless otherwise specified.

1) Remove current line – (Ctrl + L)

 

2) Generate constructor – (ctor + Tab + Tab)

 

3) Generate foreach loop – (foreach + Tab + Tab)

 

4) Generate for loop – (for + Tab + Tab)

 

5) Generate try catch block – (try + Tab + Tab)

 

6) Create properties – (prop + Tab + Tab)

 

7) Format code – (Ctrl + K + D)

 

8) Collapse all code – (Ctrl + M + O)

 

9) Expand / Collapse code block – (Ctrl + M + M)

 

10) Comment code – (Ctrl + K + C)

 

11) Uncomment code – (Ctrl + K + U)

 

12) Rename method or variable – (Ctrl + R + R)

 

13) Go to definition – (F12)

 

14) Paste and cycle through clipboard history – (Ctrl + Shift + V)

One Response

Leave a Reply

Your email address will not be published.

Share on facebook
Share on twitter
Share on linkedin

Related articles