Widen Scope
Purpose
Moves a variable declaration out of the parent code block, which makes it available in a parent scope.
Availability
Available on a variable declaration within a loop, or a conditional statement.
Usage
Place the caret on a variable 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 Widen Scope from the menu.
After execution, the Refactoring moves the variable declaration out of the current scope.
See Also