Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Path.VolumeSeparatorChar Field

Provides a platform-specific volume separator character.

[Visual Basic]
Public Shared ReadOnly VolumeSeparatorChar As Char
[C#]
public static readonly char VolumeSeparatorChar;
[C++]
public: static __wchar_t VolumeSeparatorChar;
[JScript]
public static var VolumeSeparatorChar : Char;

Remarks

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".

Example

[Visual Basic, C#, C++] The following example demonstrates the use of the VolumeSeparatorChar 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 Language Filter 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

See Also

Path Class | Path Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File

Show:
© 2015 Microsoft