Remove Redundant Assignment
Purpose
Removes the initialization of a variable if it is initialized with the default value.
Availability
Available when the caret is on the name of a field in its declaration, provided that the field is initialized with the default value.
Usage
Place the caret on the name of a field 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 Remove Redundant Assignment from the menu.
After execution, the Refactoring removes the assignment, which does not change code behavior.
See Also