How does C# cope with file separators? Is it always assumed the file separator is "\" (or "\\" and does this have to be escaped like this?
+13
A:
I think Path.DirectorySeparatorChar is what you need. You can find it in the System.IO namespace.
Geo
2009-10-08 20:59:33
Sorry for pointing to PathSeparator, I fixed it now.
Geo
2009-10-08 21:01:10
+5
A:
To combine paths use, and as suggested by Geo, this works in conjunction with DirectorySeparatorChar
IO.Path.Combine("path", "file.ext");
Yannick M.
2009-10-08 21:00:37
+1
A:
If by file separators, you really mean directory separators, then you need Path.DirectorySeparatorChar and Path.AltDirectorySeparatorChar.
These will get the relevant platform-specific characters, without having to hard-code them (and also avoiding the need to escape them properly).
adrianbanks
2009-10-08 21:10:39