ReSharper Web Help

You will learn how to:

To move a type member up or down
  1. Place the caret at a member declaration, for a example at its name.
  2. To move the member up or down, do one of the following:
    • On the main menu, choose ReSharper | Edit | Rearrange Code | Move Up or ReSharper | Edit | Rearrange Code | Move Down.
    • Press Ctrl+Shift+Alt+Up or Ctrl+Shift+Alt+Down.

Look at the example below:

Coding_Assistance__Moving_Code_Elements__Examples_01

Press Ctrl+Shift+Alt+Down to move NodeMouseEnter down. If there are XML comments, ReSharper moves not only declarations, but also related XML comments.

Coding_Assistance__Moving_Code_Elements__Examples_02

To reorder method parameters
  1. Place the caret at any parameter in a method declaration or a method call.
  2. To move the parameter to the right or to the left within the parameter list, do one of the following:
    • On the main menu, choose ReSharper | Edit | Rearrange Code | Move Right or ReSharper | Edit | Rearrange Code | Move Left.
    • Press Ctrl+Shift+Alt+Right or Ctrl+Shift+Alt+Left.

Tip

In order to move method parameters both in method declaration and all its usages, use the Change Signature refactoring.

Consider the example below:

Coding_Assistance__Moving_Code_Elements__method_parameters__01

Coding_Assistance__Moving_Code_Elements__method_parameters__02

To move statements within a block
  1. Place the caret anywhere in a statement.
  2. To move the current statement up or down within the block of code, do one of the following:
    • On the main menu, choose ReSharper | Edit | Rearrange Code | Move Up or ReSharper | Edit | Rearrange Code | Move Down.
    • Press Ctrl+Shift+Alt+Up or Ctrl+Shift+Alt+Down.

Look at the example below:

Coding_Assistance__Moving_Code_Elements__move_statements_within_01

Press Ctrl+Shift+Alt+Down to move if statement down.

Coding_Assistance__Moving_Code_Elements__move_statements_within_02

To move statements out of or into a block
  1. Place the caret anywhere in a statement.
  2. To move the current statement out of or into the block of code, do one of the following:
    • On the main menu, choose ReSharper | Edit | Rearrange Code | Move Left or ReSharper | Edit | Rearrange Code | Move Right.
    • Press Ctrl+Shift+Alt+Left or Ctrl+Shift+Alt+Right.

Look at the example below:

Coding_Assistance__Moving_Code_Elements__move_statements_out_of_01

Press Ctrl+Shift+Alt+Left, then press Ctrl+Shift+Alt+Down to move into if statement.

Coding_Assistance__Moving_Code_Elements__move_statements_out_of_02

Obviously, it is easier to move one brace than one statement. From now and then, you can move the closing brace of a code block including and excluding statements.

To move closing brace up or down
  1. Place the caret at the closing brace of a code block.
  2. Do one of the following:
    • On the main menu, choose ReSharper | Edit | Rearrange Code | Move Up or ReSharper | Edit | Rearrange Code | Move Down.
    • Press Ctrl+Shift+Alt+Up or Ctrl+Shift+Alt+Down.

Look at the example below:

ReSharper_by_Language__CSharp__Moving_Code_Elements__Brace_01

ReSharper_by_Language__CSharp__Moving_Code_Elements__Brace_02