Refactoring - Introducing Variables

From RAD Studio
Jump to: navigation, search

Go Up to Refactoring Procedures Index


This topic explains how to use the "Introduce variable" operation.

To introduce a new variable:

  1. Select variable in the Editor.
  2. On the main menu, choose Refactor > Introduce Variable.

    Tip: Alternatively, you can choose Refactor > Introduce Variable on the context menu.

  3. In the resulting dialog, specify the Name of the new variable. The new variable created is given the same type as the original variable.
  4. If desired, check Replace all occurrences. The Introduce Variable dialog indicates the number of occurrences that it will replace with the new variable.

    Note: The refactoring does not replace any occurrences of the variable prior to the point in the code at which you selected to introduce the new variable.

See Also