coderushforroslyn-119021-code-style-assistance-move-to-region.md
This feature allows you to move a member or type to the desired region. This task includes the following steps:
Open the Move to Region menu.
Select a target region from the Move to Region menu and press Enter.
In the screencast below, Move to Region is used to move the “field3” private field to the “Private fields” region:
If you know the name of an existing region, you can type it in the Move to Region menu. CodeRush shows this region in the list.
Note
The Move to Region menu shows regions in the same order they appear in code.
If a target region does not exist for a selected member/type, the Move to Region feature can create it and embed a selected member/type to this region. To do this, follow the steps below:
Open the Move to Region menu for a selected type/member.
Type a target region name.
Choose the newly-created item from the list and press Enter.
In the screencast below, Move to Region embeds the “field3” public field into the newly-created “Public fields” region:
Do one of the following:
Use the Member Icon menu
Create a MoveToRegion command shortcut
Enable the Member Icons feature.
Click the icon on the left of a desired member/type and select the Move to Region item:
Choose the CodeRush | Shortcuts… menu item to open the Shortcuts options page.
Select a desired shortcut in the shortcuts folder or create a new one.
Specify a shortcut in the First shortcut text box. In this example, the shortcut is Ctrl + J.
Choose the MoveToRegion command from the list.
Click Apply and OK to save the shortcut configuration and close the Shortcuts options page.
Place the caret in the required member/type. Then, press your shortcut to open the Move to Region menu (in this example, Ctrl + J ).
You can configure the Move to Region feature on the Editor | All Languages | Move to Region options page.
For more information, see the following topic: Move to Region Settings.