Split Initialization From Declaration
Purpose
This Refactoring is used when the variable is declared and initialized in the same statement. It breaks this statement into two lines: separates the initialization from declaration. It is useful for conditional initialization, or when you need to widen the scope of the declaration.
Availability
Available when the caret is on a variable name in the statement where it is declared and initialized.
Usage
Place the caret on a variable name in its initialized declaration.
NOTE
The blinking cursor shows the caret's position at which the Refactoring is available.
- Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
- Select Split Initialization From Declaration from the menu.
After execution, the Refactoring moves the variable initialization to the separate statement.
See Also