Skip to main content

Use String.Format

Converts a composed string expression into a single String.Format call.

#Availability

Available from the context menu or via shortcuts:

  • when the currently selected code block contains string concatenation.

#Example

string result = "Total = " + total.ToString();
Dim result As String = "Total = " + total.ToString

Result:

string result = String.Format("Total = {0}", total);
Dim result As String = String.Format("Total = {0}", total)

#Screenshot

rsUseStringFormatCSharp