Compiler Error CS1009
Visual Studio 2010
Unrecognized escape sequence
An unexpected character follows a backslash (\) in a string. The compiler expects one of the valid escape characters. For more information, see Character Escapes.
The following sample generates CS1009.
// CS1009-a.cs class MyClass { static void Main() { // The following line causes CS1009. string a = "\m"; // Try the following line instead. // string a = "\t"; } }
A common cause of this error is using the backslash character in a file name, as the following example shows.
To resolve this error, use "\\" or the @-quoted string literal, as the following example shows.