Hi......
Which string prevent escaping on backslash in C# ? Please explain ?
Thanks......
String prevent escaping on backslash
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Feb 6, 2012, 1:34 PM EST
You could have achieved the same effect as the verbatim string by simply doubling the backslashes which enables them to be treated as an ordinary character rather than an escape character prefix:
string s = "\\t\\n"; // same effect as @"\t\n"
Jignesh TrivediRank #16 · 50.3K reputationPosted Feb 6, 2012, 5:45 PM EST
I have the same opinion as vulpes..
you have only two option.
string d= @"c:\TestProject";
or
string d = "C:\\testProject";
hope this help.
Vineet Kumar SainiRank #257 · 9.8K reputationPosted Feb 8, 2012, 10:29 AM EST