Windows Phone Developers

Saturday, September 6, 2008

Unrecognized escape sequence (error CS1009)

A common case for this error is using the backslash character in a file name. Replace “\” with “\\” or use “@” prefix for the literal as shown below




Error



StreamWriter SW = new StreamWriter("c:\shasurdata\forblogger\Sample.txt");


Corrected



StreamWriter SW = new StreamWriter("c:\\shasurdata\\forblogger\\Sample.txt");



Or



StreamWriter SW = new StreamWriter(@"c:\shasurdata\forblogger\Sample.txt");



Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

7 comments:

  1. You save my time!
    Thanks
    Talley
    Developer,Raleigh,NC

    ReplyDelete
  2. Thank you! You saved me loads of time!

    ReplyDelete
  3. tanx a lot dude...:):):)

    ReplyDelete
  4. THX MATE U SAV EMY LIFE............

    ReplyDelete
  5. Thanks. I had a really odd case where I have to escape the '*' and this allows is since it's an Oracle SQL query and somehow Oracle allows it without a problem

    ReplyDelete

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005