Visual Studio.NET: How To Comment/Uncomment Large Blocks of Code
Just a quick tip that I find extremely useful: To comment a large block of code (at least for VB.NET, I don’t know if it works in C#, but I assume it does), highlight the area you want to comment out and hold Ctrl and press K and then C. To uncomment, highlight the commented area and hit Ctrl + K + U. The mass uncommenting merely removes the forward-most apostrophe, so if you have actual comments in your commented code that were included in your initial highlighted region, they will remain comments upon uncommenting.
I use this technique a lot for debugging large areas of code.
Doesn’t necessarily have to be “large” blocks of code. It works anywhere. Thanks for the tip though 🙂
Comment by Raza | May 6, 2008 |
True! However, typically for smaller blocks I just hit the apostrophe key. Thanks for the comment 🙂
Comment by Some.Net(Guy) | May 6, 2008 |
Thanks a lot for your tip. I recently began coding in VB.Net for my seniour project. I have found it much more advanced than the language I know before (C++).
Finally, I want to know what threading is and how to use it in VB.Net. Please post something about it.
Have a nice time.
Comment by Nebrom | May 23, 2008 |
Check out http://www.helpwithdotnet.com/
Specialized Search Engine to help you with DotNet (.NET) development
Comment by raj | July 26, 2008 |
Yes, I agree.
This keystroke is useful on a large block of code. Most of the time, a simple apostrophe will do…:)
Comment by Stephen | August 3, 2008 |
It worked thanks.
Comment by thankxx | June 23, 2009 |
For VB.net 2008, under the “Edit” menu, select “Advanced” and then either “Comment Selection” or “Uncomment Selection”.
Comment by John | June 9, 2011 |
This trick works on both C# and VB.NET in VS08 and VS10 (and maybe VS05, but I haven’t tested it)
Comment by Some.Net(Guy) | June 9, 2011 |
Thanx for tip, really handly for any code demanding commenting
Comment by $Kay | May 13, 2013 |