Skip to main content

CRR0052 - String interpolation can be used

This analyzer identifies composed string expressions which can be converted to interpolated strings. Interpolated strings are easier to read than formatted strings.

return "Found record at the position " + i;

To fix this issue, use the interpolated string instead of the composed string expression.

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

Call the Convert to String Interpolation refactoring to replace the composed string with an interpolated string. To do it in different places at once, use the Code Cleanup feature with the Convert to String Interpolation rule enabled.