Add and Remove #region Blocks
JetBrains Rider can help you quickly add, move and remove
#region blocks in your code.
Managing regions in the editor
Right in the editor, you can quickly surround the current selection with region. JetBrains Rider will add the
#endregion directives and set the caret in the position where you can type the region name.
You can also move regions in different ways using the Move code element feature:
You can move the
#endregiondirectives up and down so that the region includes the neighbouring elements, or so that the elements are left out of the region. To do so, set the caret at the directive that you want to move, press Ctrl+Shift+Alt, and then use the up and down arrow keys.
You can move the whole region up and down in the scope. To do so, select the whole region including
#endregiondirectives, press Ctrl+Shift+Alt, and then use the up and down arrow keys.
To remove an existing region, press Alt+Enter and choose the corresponding context action.
Note that you can also apply this action in a wider scope. For example, you can use it to remove all #region blocks in the entire solution:
Working with regions in the File Structure window
Regions that surround types and/or type members appear in the File Structure window. You can expand/collapse regions to show/hide items inside them.