A platform-specific separator character used to separate path strings in environment variables.
[Visual Basic]
Public Shared ReadOnly PathSeparator As Char
[C#]
public static readonly char PathSeparator;
[C++]
public: static __wchar_t PathSeparator;
[JScript]
public static var PathSeparator : Char;
Remarks
On Windows-based desktop platforms, the value of this field is the semicolon (;) by default, but might vary on other platforms.
Example
[Visual Basic, C#, C++] The following example demonstrates the use of the PathSeparator field.
[Visual Basic]
Console.WriteLine("Path.AltDirectorySeparatorChar={0}", Path.AltDirectorySeparatorChar)
Console.WriteLine("Path.DirectorySeparatorChar={0}", Path.DirectorySeparatorChar)
Console.WriteLine("Path.PathSeparator={0}", Path.PathSeparator)
Console.WriteLine("Path.VolumeSeparatorChar={0}", Path.VolumeSeparatorChar)
Console.Write("Path.InvalidPathChars=")
Dim c As Char
For Each c In Path.InvalidPathChars
Console.Write(c)
Next c
Console.WriteLine()
[C#]
Console.WriteLine("Path.AltDirectorySeparatorChar={0}",
Path.AltDirectorySeparatorChar);
Console.WriteLine("Path.DirectorySeparatorChar={0}",
Path.DirectorySeparatorChar);
Console.WriteLine("Path.PathSeparator={0}",
Path.PathSeparator);
Console.WriteLine("Path.VolumeSeparatorChar={0}",
Path.VolumeSeparatorChar);
Console.Write("Path.InvalidPathChars=");
foreach (char c in Path.InvalidPathChars)
Console.Write(c);
Console.WriteLine();
[C++]
Console::WriteLine(S"Path::AltDirectorySeparatorChar={0}",
(Path::AltDirectorySeparatorChar).ToString());
Console::WriteLine(S"Path::DirectorySeparatorChar={0}",
(Path::DirectorySeparatorChar).ToString());
Console::WriteLine(S"Path::PathSeparator={0}",
(Path::PathSeparator).ToString());
Console::WriteLine(S"Path::VolumeSeparatorChar={0}",
(Path::VolumeSeparatorChar).ToString());
Console::Write(S"Path::InvalidPathChars=");
for (int i = 0; i < Path::InvalidPathChars->Length; i++)
Console::Write( Path::InvalidPathChars[i]);
Console::WriteLine();
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard
See Also
Path Class | Path Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File