Why can't I use @$ prefix before strings?

  • A+
Category:Languages

All these string prefixes are legal to use in C#:

  "text"  @"text"  $"text" $@"text" 

Why isn't this?

@$"text" 

One would have thought that the order of these operators doesn't matter, because they have no other meaning in C# but to prefix strings. I cannot think of a situation when this inverted double prefix would not compile. Is the order enforced only for aesthetic purposes?

 


Interpolated verbatim strings are not allowed, for no other reason than they haven't been implemented.

Good news though, in C# version 8 which is due out in the not too distant future, this will be allowed. You can try it out if you install the Visual Studio 2019 preview.

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: