Commenting and Uncommenting Code
With Rider, a single keystroke is enough to comment or uncomment code.
Commenting and uncommenting with line comments
// Commented line in C# ...
If there is no selection, Rider will comment the current line, or uncomment if the line is commented, and moves the caret to the next line.
If there is a selection, Rider will comment or uncomment all the lines that the selection spans. Even if a line is partly selected, the comment mark is inserted in the beginning of this line.
Commenting and uncommenting with block comments
/* Commented code block in C# ... */
If there is no selection, Rider will create an empty block comment at the first whitespace that follows the current caret position.
If the caret is within a block comment, the block is uncommented.
If there is a selection, Rider will add block comment marks in the beginning and in the end of the selection. The caret is moved to the end of the block comment.
An alternative way to comment any block of code is to select it, press Alt+Enter and choose Comment selection. The same way works for uncommenting code inside a block comment - set the caret anywhere in the block comment, press Alt+Enter and choose Uncomment.