How to use verbatim strings with interpolation?
You can apply both $
and @
prefixes to the same string:
string s = $@"Result...
Adding ""{x}"" and {this.Y()} to foobar:
{x.GetLog()}";
Since being introduced in C# 6, interpolated verbatim strings had to start with the tokens $@
, but starting with C# 8, you can use either $@
or @$
.