ReSharper 2024.1 Help

Code inspection: Redundant string interpolation

This inspection reports interpolated strings that do not have any interpolation expressions inside. In this case, the interpolated strings — for example $"text" — can be replaced with a regular string literal "text".

Although the redundant $ character will not influence your code in any way, this inspection can still help you spot places that look like interpolated expressions but are not:

public class Sample { void Print(string name) { // No interpolation expressions Console.WriteLine($"Hello (name)"); // Interpolation expressions in the sting Console.WriteLine($"Hello {name}"); } }
Last modified: 27 May 2024