Visual Studio has a toolbar button/keyboard shortcut/menu item that comments out selected lines of C# code using //
.
Is there an equivalent that comments out just the selected code using /* ... */
?
e.g.
Given this code
string s = "hello";
Console.WriteLine(s + " world");
If you select + "world"
and hit Ctrl+K, Ctrl+C then you end up with
string s = "hello";
//Console.WriteLine(s + " world");
However, I would like
string s = "hello";
Console.WriteLine(s /*+ " world"*/);
This would be useful for when I am making some experimental and temporary amendements to an existing codebase whilst fixing a few bugs.
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.
Press Ctrl + C .
Resharper does that. It costs money - but it is worth it.
It's called "Block Comment".
And the default keyboard shortcut is Ctrl+Shift+/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With