Multiple choice technology programming languages

Which of these string definitions will prevent escaping on backslashes in c#?

  1. String s=#”\teststring”;

  2. String s=”’\n teststring”;

  3. String s=@”\teststring”;

  4. none of above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In C#, prepending a string literal with the @ symbol creates a verbatim string literal. In verbatim strings, escape sequences such as backslashes are not processed, allowing backslashes to be written directly. The # symbol has no such function in C# string syntax.