C# Error CS8401 – To use ‘@$’ instead of ‘[email protected]’ for an interpolated verbatim string, please use language version ‘{0}’ or greater.

C# Error

CS8401 – To use ‘@$’ instead of ‘[email protected]’ for an interpolated verbatim string, please use language version ‘{0}’ or greater.

Reason for the Error & Solution

To use @$ instead of [email protected] for an interpolated verbatim string, please use language version ‘8.0’ or greater.

In older versions before C# 8.0, verbatim interpolated strings were only allowed using [email protected]. Starting with C# 8.0, you can use [email protected] or @$.

To correct this error

Either replace @$ with [email protected], or upgrade to C# 8.0 or later.