All rules
IDE0071Language rules (expression-level preferences)
Simplify interpolation
Simplify interpolation
Microsoft docsDescription
This style rule concerns with simplification of interpolated strings to improve code readability. It recommends removal of certain explicit method calls, such as ToString(), when the same method would be implicitly invoked by the compiler if the explicit method call is removed.
Example
// dotnet_style_prefer_simplified_interpolation = true
var str = $"prefix {someValue} suffix";
// dotnet_style_prefer_simplified_interpolation = false
var str = $"prefix {someValue.ToString()} suffix";Configurable options
Vote for the value each option should take in the generated .editorconfig.
dotnet_style_prefer_simplified_interpolation default:
trueYour vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0