String.Split With Backslash

var lines = fileContents.Split(“n”[0]);

works but I want to do this

    var lines = fileContents.Split("\"[0]);

but it does not allow me to use a backslash? I need to parse file locations. Any Ideas?

You don’t need to use a backslash at all, just use / for path separators. Actually this is mandatory unless you’re 100% sure you’re never going to use your app on anything except Windows, but even in that case it’s a good idea to get in the habit of using / because that’s universal and works everywhere (including Windows).

In those cases where you do need to use a backslash for whatever reason, the \ character is an escape character, so to use the actual \ character you should use \\.

To parse file location, just use the C# built-in Path class. It is supported on any platform with the exception of a few methods when building the game as a webplayer.

edit: As @Eric5h5 cleared up, the Path class is available for the whole .Net framework, not just C#.