string value1 = File.ReadAllText("C:\\file.txt");
string value2 = File.ReadAllText(@"C:\file.txt");
In the above statements when is the difference of using @”C:\file.txt” and C:\file.txt
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
the string for value1 will contain a formfeed character where the \f is, while the second one will keep the backslash and the f. (This becomes very clear if you try to output them in a console application with Console.Write…)
The correct way for the value1 version would be
"C:\\file.txt"(The value2 version uses whats called, as Dmitry said, a verbatim string)