In the Path
class, there are two fields for directory separator chars, Path.DirectorySeparatorChar
and Path.AltDirectorySeparatorChar
. I know it's not .NET specific but OS dependent but I don't understand why there are two such characters instead of one.
For example there is only one Path.VolumeSeparatorChar
.
The value of this field is a backslash ('\') on UNIX, and a slash ('/') on Windows and Macintosh operating systems.
From MSDN system.io.path.altdirectoryseparatorchar
As for Path.VolumeSeparatorChar :
The value of this field is a colon (:) on Windows and Macintosh, and a
slash (/) on UNIX operating systems. This is most useful for parsing
paths such as "c:\windows" or "MacVolume:System Folder".
However note that on UNIX there is no volume separator as devices are mounted on the filesystem at a mount point, which is a directory. So one really accesses files with directory separators, therefore causing no ambiguity.