Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard shortcut to comment/uncomment selected code?

In Visual Studio 2008, is there a keyboard shortcut to comment/uncomment selected lines of code?

like image 955
Vivian River Avatar asked Apr 14 '11 18:04

Vivian River


People also ask

How do you uncomment a chunk of code?

To comment out multiple code lines right-click and select Source > Add Block Comment. ( CTRL+SHIFT+/ ) To uncomment multiple code lines right-click and select Source > Remove Block Comment. ( CTRL+SHIFT+\ )

How do you uncomment a code on a keyboard?

Comment Code Block Ctrl+K+C/Ctrl+K+U If you select a block of code and use the key sequence Ctrl+K+C, you'll comment out the section of code. Ctrl+K+U will uncomment the code.

How do you uncomment multiple lines in comments?

Press Ctrl + / To uncomment a line / lines: Select the required line(s).


2 Answers

  • CTRL + K, followed by CTRL + C for commenting
  • CTRL + K, followed by CTRL + U for uncommenting

For more good stuff, check Favorite Visual Studio keyboard shortcuts.

like image 58
Fredrik Mörk Avatar answered Sep 18 '22 00:09

Fredrik Mörk


Look under the Edit->Advanced menu. I actually changed mine to CTRL-/, CTRL-/ so I can't remember what the original was.

like image 27
Tod Avatar answered Sep 18 '22 00:09

Tod