C# 8 is fixing interpolated verbatim strings

Ever since string interpolation has been added as a feature in C# there was a minor nuissance that was bugging me quite a bit. If you were using String interpolation on a verbatim string you had to put the symbols in a specific order or else it would not work.

For example the following piece of code would throw a compilation error

And to be specific the exact error it would throw would be

The problem was that @ and $ should be reversed in order for them to be in the correct order. In order to remember the order I was always thinking that @ defines how the characters inside a double quotes are and the $ actually generates the string with the whole set of data, one needs to be executed before the other, thus the specific order. But, in C# 8 both the following would compile successfully.

So my personal nuissance has been eliminated.

Not such a big deal to be honest, but well, if it’s fixed, then why not use it? 🙂

Please follow and like us:

Leave a Reply