Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Change String.Format to Interpolated Strings
Change String.Format to Interpolated Strings

Change String.Format to Interpolated Strings

Sandeep Upadhyay (Fighter)

|
1,064 installs
| (2) | Free
This tool is an extension to the Analyzer that is present in Visual studio. This tool will highlight all the occurrences of usage of string.Format in the code and highlight it by default as warning. Tool will allow the user to option to change the syntax to new way o...
Download

Description:

This tool is an extension to the Analyzer that is present in Visual studio. This tool will highlight all the occurrences of usage of string.Format in the code and highlight it by default as warning. Tool will allow the user to option to change the syntax to new way of String Interpolation in Place of string.Format which is available with C# 6.0.

For more details on String Interpolation, refer MSDN link Interpolated Strings

Old Way

New Way

string firstName = "John";

string lastName = "Cena";

Console.WriteLine(string.Format("Hi {0} {1}", firstName, lastName)); 

string firstName = "John";

string lastName = "Cena";

Console.WriteLine($"Hi {firstName} {lastName}");

 

Features:

  1. Available as extension for Visual Studio 2015(Community, Pro and Enterprise editions)
  2. Uses Visual studio code refactoring features such as shortcut to access this tool (Ctrl + ‘.’) and Preview before applying the changes.
  3. Extension will change the syntax to new way of String Interpolation in Place of string.Format.
  4. This has the capability to replace the syntax for the highlighted code, or all the occurrences in file, project or entire solution.

 

Snapshots:

1. Intial view of the string.Format syntax in the code

2. Quick view of the fix

3. Preview of fix in single file

4. Preview of fix in entire solution

5. Code after the fix is applied

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft