Visual Studio TnT #1: toggling comments like a ninja!
Nov
13
Written by:
Saturday, November 13, 2010 9:22 PM
Want to learn some cool new Visual Studio tips'n'tricks? Read on!
Tip'n'Trick: Commenting and Uncommenting
Shortcut: Comment: CTRL+K, CTRL+C,Uncomment: CTRL+K, CTRL+U
Da "Peter" version (aka, ya, da verbose one)
Are you looking to become more proficient, efficient and just overall BETTER with Visual Studio? Well, keep your browsers/RSS readers/WP7 phones, heck even your iPads to this blog and I'll show you some cool and hopefully new Visual Studio Tips'n'Tricks!
We'll start off this series with commenting/uncommenting your code.
Situation
- Ever wanted to just comment out a section of code but didn't want to have to type out the "//" over and over on every line for 50 lines?
- Too bored to put the starting /* and the closing */ tag?
- Ever wanted to "just try something out" with a piece of code but not remove it, just kind of "move it out of the way for a sec?"
- You unsure if a piece of code is run, so you want to quickly comment run, analyis uncomment it back in?
If you've ever found yourself in this situation, you don't have to cut'n'paste the comment characters (//) on every single like, nor do you have to use the start comment and end comment tags (/* and */) for line groupings. NO! Select the code you want commented out, then use the CTRL+K, CTRL+C to comment and the inverse of that CTRL+K, CTRL+U to uncomment your selected text.
Now that you know how to comment and uncomment code like a pro, it's time to grab a coffee and get coding!