Back to Devexpress

Rename

coderushforroslyn-116895-refactoring-assistance-rename.md

latest1.3 KB
Original Source

Rename

  • Jul 19, 2021
  • 2 minutes to read

Purpose

Renames a symbol and updates all references to it. This refactoring runs the Visual Studio’s Rename quick action.

Availability

Available when the caret is in a symbol declaration.

Usage

  1. Place the caret in a code symbol (a field, local variable, method, namespace, property, or a type).

  2. Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.

  3. Select Rename from the menu and press Enter.

  4. In the code editor, type the new symbol name. Press Enter or click Apply in the Rename hint to save the change.

After execution, this refactoring changes the symbol name and updates all references to it.

csharp
static void Main(string[] args) {
    Console.Write("Mass (kg): ");
    double mass = Convert.ToDouble(Console.ReadLine());
    Console.WriteLine($"F = {mass * 9.807} N");
    Console.ReadLine();
}
vb
Sub Main()
    Console.Write("Mass (kg): ")
    Dim mass As Double = Convert.ToDouble(Console.ReadLine())
    Console.WriteLine("F = {0} N", mass * 9.807)
    Console.ReadLine()
End Sub