The requested page is not available for the requested platform. You are viewing the content for Default platform.

Rename

Purpose

Renames the symbol and updates all references to it. This refactoring is used to add Visual Studio's Rename Quick Action to the Code Actions menu and make the Rename action easier to invoke.

Availability

Available when the caret is on the symbol declaration or usage.

Usage

  1. Place the caret on a method parameter.

    Note

    The blinking cursor shows the caret's position at which the Refactoring is available.

    static void Main(string[] args) {
        Console.Write("Mass (kg): ");
        double m = Convert.ToDouble(Console.ReadLine());
        Console.WriteLine($"F = {m * 9.807} N");
        Console.ReadLine();
    }
    
  2. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
  3. Select Rename from the menu.
  4. Type the new symbol name and press Enter.

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

static void Main(string[] args) {
    Console.Write("Mass (kg): ");
    double mass = Convert.ToDouble(Console.ReadLine());
    Console.WriteLine($"F = {mass * 9.807} N");
    Console.ReadLine();
}