+4  A: 

No, because the compiler has already converted all of your escaped characters in the original string to the characters they represent. After the fact, it is too late to convert them to non-special characters. You can do a search and replace, converting '\n' to literally @"\n", but that is whacky and you're better off defining the string correctly in the first place. If you wanted to escape the backslashes in the first place, why not put an extra backslash character in front of each of them:

Instead of "\n" use "\\n".

Updated in response to your comment:

If the string is coming from user input, you don't need to escape the backslash, because it will be stored as a backslash in the input string. The escape character only works as an escape character in string literals in code (and not preceded by @, which makes them verbatim string literals).

Michael Goldshteyn
suppose this string would be passed inside the program for example from user input ,i know the nature of \\ but using @ is a safe way.it seems thati ts impossoble if we want to have an extention method or helper method that converts a string to non escape character version using @. am i right? if this is true, could any one suggest me a method that converts a string to non-escap character version that works correctly?thanks
Siamak
thank u michael
Siamak
+1  A: 

if you want "\n\n\a\a\r\blah" to print as \n\n\a\a\r\blah without @ just replace all \ with \\

\ is the escaper in a non-verbatim string. So you simply need to escape the escaper, as it were.

Anthony Pegram
sorry for too late, my computer had been infected terribly .ok could you pls suggest some snippet that replace \ with \\ in the string ,i try many codes but it seems that compiler just doesnt like to understand what we want, thanks
Siamak
A: 

If you want to use both strings, but want to have only one in the code then write the string with @, and construct the other one with Replace(@"\n","\n").

Dialecticus
A: 
Siamak