How can I use escape characters with string interpolation in C# 6?

Escaping with a backslash(\) works for all characters except a curly brace.

If you are trying to escape a curly brace ({ or }), you must use {{ or }} per $ – string interpolation (C# reference)

… All occurrences of double curly braces (“{{“ and “}}”) are converted to a single curly brace.

Leave a Comment