File name has two backslashes C#
c#, datetime, file, filenames, save
Solution
Nope, that string really has single backslashes in. Print it out to the console and you'll see that.
If you look at it in the debugger, you'll see the backslashes escaped - but the string itself has single backslashes. This bites lots of people :(
Problem
There is probably an easy answer for this, but when I added `DateTime.Now.ToString()` to my fileName it adds an extra \ for every \ I have so `C:\Temp` becomes `C:\\Temp` which causes the file not to save. This is the code in question ``` String fileName = @"C:\Temp\data_" + DateTime.Now.ToString() + ".txt"; ``` For example the output could be `C:\\Temp\\data_12/04/2012 20:08:40.txt` It should be `C:\Temp\data_12/04/2012 20:08:40.txt`