Well, the last one ( "abc\\xyz" ) will certainly result in a backslash in the string - or you could use a literal string literal:
string str = @"abc\xyz";
Note that if you use the debugger to view your lines, it often (always?) "Runs away" from them for you, so you will see "abc\\xyz" . This can cause confusion. Either look at the characters individually, or print a line on the console.
You did not say how it "does not work" - could you give more detailed information? If this is only the output of the debugger, then everything above could be everything that you are looking for - but otherwise you should tell us what you see and what you expected to see.
Look at my article on strings for more information on strings in general, escaping, debugger, etc ..
source share