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... All author proceeds go directly to sending Hurricane Katrina survivors to college.

      Microsoft Visual Studio Tips book

      Recent Entries

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

Visual Studio 2008 ワンポイント said:

今日は、本当に簡単にできる操作をご紹介します。 コードをコメント化するには、 Ctrl + K 、 Ctrl + C キーを使用します。コードのコメントを解除するには、 Ctrl + K 、 Ctrl

# July 13, 2008 11:49 PM

Секреты Visual Studio said:

Самая простая вещь в этой жизни, не так ли? Используйте Ctrl + K , Ctrl + C для закомментирования кода

# July 30, 2008 4:59 AM

Sara Ford's Tip of the Day - in Italiano said:

Ah, la vita è veramente nelle cose semplici, non è vero? Utilizzate Ctrl+K, Ctrl+C per commentare il

# November 28, 2008 1:05 PM

Korea Evangelists said:

디버깅을 하다 코딩 일부분을 주석처리 하는 경우가 많습니다. 이때 필요한 단축키가 Ctrl+E+C 입니다. Ctrol 키와 E를 누른 상태에서 C를 누릅니다. 반대는 Ctrl+E+U

# April 9, 2009 8:03 PM
New Comments to this post are disabled
Page view tracker