Welcome to MSDN Blogs Sign in | Join | Help

Sara Ford's WebLog


My adventures embracing open source on CodePlex and at Microsoft

News

Did you know... How to quickly comment and uncomment code using keyboard shortcuts? - #017

Ah, it really is the simple things in life, isn't it?

Use Ctrl+K, Ctrl+C to comment code and Ctrl+K, Ctrl+U to uncomment code.  All the default settings, including the General Development Settings, Visual Basic, C#, and C++ have these commands bound to this keyboard shortcut.

You can find these commands under the Edit - Advanced menu at

Comment and Uncomment Code Menu Items

If your keybindings are different, check out yesterday's tip on how to see what command is bound to what keyboard shortcut.

Technorati tags: ,
Posted: Friday, August 17, 2007 3:00 AM by saraford

Comments

Björn said:

You might want to add that the nice comment command behaves a bit differently in C++ and C#: In C++, when you select a part of a line (say, a variable in a function call) Ctrl+K, Ctrl+C adds a block comment containing only the select part while in C# comments out the whole comment. The C# all-or-nothing way is a rather annoying speed bumper when you got used to the C++ way during the past decade :]

# August 17, 2007 6:52 AM

Jason Haley said:

# August 17, 2007 10:45 AM

Jason Haley said:

# August 17, 2007 10:52 AM
New Comments to this post are disabled
Page view tracker