Make Implicit/Explicit

Purpose

Converts an explicitly-typed variable declaration to an implicit one and vice versa. You can use implicitly typed variables to avoid redundancy and increase code readability. On the other hand, the explicit typing helps to avoid mistakes.

Availability

Available when the caret is on a variable declaration.

Usage

  1. Place the caret to a variable declaration.

    Note

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

    var i = 10;
    
  2. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
  3. Select Make Explicit from the menu (Make Implicit if the variable is declared explicitly).

After execution, the Refactoring changes the variable type to implicit or changes the implicit type to the most suitable explicit type.

int i = 10;
Note

This feature is available as a part of Code Cleanup.

See Also