C# char "//" path separator

Path.DirectorySeparatorChar gives you the character used to separate directories in a path, i.e. you use it in paths.

Path.PathSeparator gives you the character used to separate paths in environment variables, i.e. you use it between paths.

For example, your system's PATH environment variable will typically list multiple paths where the OS will look for applications to run.

On Windows, Path.PathSeparator is ;, and Path.DirectorySeparatorChar is \. Two paths would be stored in an environment variable like this:

set PATH="C:\first\path;C:\second\path"

Is System.IO.Path.PathSeparator what you're loking for? There's also .DirectorySeparatorChar and others. See the System.IO.Path class under "Fields".

Tags:

C#

Separator