Skip to main content

Convert to String Interpolation


Converts a formatted string into string interpolation. Interpolated strings are much easier to read than formatted strings.


Available when the cursor is on a composed string expression (as shown in the code below) or on the call of one of the following methods, assuming the method argument contains formatted string.

  • String.Format
  • Debug.Print
  • Console.Write
  • Console.WriteLine
  • StringBuilder.AppendFormat


  1. Place the caret on a composed string expression.


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

    return "Found record at the position " + i;
  2. Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
  3. Select Convert to String Interpolation from the menu.

After execution, Refactoring replaces the composed string to the interpolated string.

return $"Found record at the position {i}";


This feature is available as a part of Code Cleanup.

See Also