Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 1.1
.NET Framework
Reference
System.IO
Path Class
Fields
 AltDirectorySeparatorChar Field
This page is specific to
Microsoft Visual Studio 2003/.NET Framework 1.1

Other versions are also available for the following:
.NET Framework Class Library
Path.AltDirectorySeparatorChar Field

Provides a platform-specific alternate character used to separate directory levels in a path string that reflects a hierarchical file system organization.

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

Remarks

The character stored in this field cannot be in InvalidPathChars. This field can be set to the same value as DirectorySeparatorChar. AltDirectorySeparatorChar and DirectorySeparatorChar are both valid for separating directory levels in a path string.

The value of this field is a backslash ('\') on Unix, and a slash ('/') on Windows and Macintosh operating systems.

Example

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

© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker