Move Declaration Near Reference
#Purpose
Moves a local variable declaration to the closest point before its first usage. This increases the code readability.
#Availability
Available when the caret is on a local variable name in its declaration.
#Usage
Place the caret on a local variable name in its declaration.
Note
The blinking cursor shows the caret’s position at which the Refactoring is available.
- Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
- Select Move Declaration Near Reference from the menu.
After execution, the Refactoring moves the variable declaration to the closest point before its first usage.