The Introduce Variable refactoring allows you to define a local variable for a selected expression, initialize the variable with the selected expression and replace the selected code with the newly defined variable.
Note |
|---|
Language Support Supported: C#, VB.NET, JavaScript, Razor Not relevant: ASP.NET, XAML, HTML |
To introduce a variable
Select an expression.
Press Alt+Insert. From the pop-up menu, select Introduce Variable.
Enter a name for the new variable or choose one of the suggested names.
- Press Enter to finish or Esc to abort the operation.
Tip |
|---|
To introduce a variable you can also navigate on the main menu. Choose JustCode | Refactor | Introduce Variable, or just press Ctrl+R, Ctrl+V |
Tip |
|---|
You can toggle name suggestions for variable name from JustCode Options dialog. |
Note |
|---|
Introduce Variable works with a selected expression where the expression can be any valid variable initializer. |
See Also