Interpolated strings from regex to string
I have a line that looks like this:
string foobar = "foo{bar}";
string bar= "bar";
Console.WriteLine(foobar);
is there a fine way to make foobar an interpolated string after it has been declared?
I know I can do this, but I am not getting foobar as an interpolated string
string bar= "bar";
string foobar= $"foo{bar}";
Console.WriteLine(foobar);
or like this, but I'm wondering if there is a nicer way to do this
string foobar = "foo{bar}";
string bar= "bar";
Console.WriteLine(foobar.Replace("{bar}", bar);
+3
source to share