Closed urmel9 closed 1 month ago
I've never observed or encountered any confusion related to these forms, so I lean against adding a rule to enforce one over the other. This is particularly true now that constant interpolated strings are treated as constants by the compiler, and thus have no penalty for use.
I agree with @sharwell on this, the biggest factor is that it's no longer a performance penalty. If there was a performance penalty, or even a potential for formatting issues, this would be a very useful rule.
@sharwell @dmcnaughton-nbc Okay, if there is no performance issue you can reject hat idea. Thanks!
Hey, it leads to confusion when you indicate with $ that the string uses String interpolation, but it doesn't. Therefore, I want to suggest a new rule: don't use string interpolation $ without interpolation expression For diagnostics you could check like this: IF string starts with $ THEN curly braces inside {} ELSE styleCop warning
WARNING: Console.WriteLine($"Hello World!");