Is there any way to set up automatic/smart string interpolation in editor? (Resharper or Visual Studio)

I was just thinking about how great it would be if this happened for me automatically:

I go to type a string, so I hit the double quotes key. What pops up is:


(the | is supposed to represent the cursor)

Then I type the string:

$"You have {newMessages.Count} new messages!";| 

(again, | is cursor)

So I didn't have to remember before starting the string to type the '$' character. Then, on the other hand if when I close my quotes, my string is something like:

"No string interpolation";| 

After closing the double quotes, the editor/resharper/visual studio automatically removed the '$' since I wasn't using string interpolation.

Does anyone know if this is possible with any of these tools?

by BiscuitOfLife via /r/csharp

Leave a Reply