Path.AltDirectorySeparatorChar Campo
Definição
Fornece um caractere alternativo específico da plataforma usado para separar os níveis de diretório em uma cadeia de caracteres de caminho que reflete uma organização do sistema de arquivos hierárquico.Provides a platform-specific alternate character used to separate directory levels in a path string that reflects a hierarchical file system organization.
public: static initonly char AltDirectorySeparatorChar;
public static readonly char AltDirectorySeparatorChar;
staticval mutable AltDirectorySeparatorChar : char
Public Shared ReadOnly AltDirectorySeparatorChar As Char
Valor do campo
Exemplos
O exemplo a seguir exibe Path valores de campo no Windows e em sistemas baseados em UNIX.The following example displays Path field values on Windows and on Unix-based systems. Observe que o Windows dá suporte à barra (que é retornada pelo AltDirectorySeparatorChar campo) ou à barra invertida (que é retornada pelo DirectorySeparatorChar campo) como caracteres separadores de caminho, enquanto os sistemas baseados em UNIX dão suporte apenas à barra.Note that Windows supports either the forward slash (which is returned by the AltDirectorySeparatorChar field) or the backslash (which is returned by the DirectorySeparatorChar field) as path separator characters, while Unix-based systems support only the forward slash.
using System;
using System.IO;
class Program
{
static void Main()
{
Console.WriteLine($"Path.DirectorySeparatorChar: '{Path.DirectorySeparatorChar}'");
Console.WriteLine($"Path.AltDirectorySeparatorChar: '{Path.AltDirectorySeparatorChar}'");
Console.WriteLine($"Path.PathSeparator: '{Path.PathSeparator}'");
Console.WriteLine($"Path.VolumeSeparatorChar: '{Path.VolumeSeparatorChar}'");
var invalidChars = Path.GetInvalidPathChars();
Console.WriteLine($"Path.GetInvalidPathChars:");
for (int ctr = 0; ctr < invalidChars.Length; ctr++)
{
Console.Write($" U+{Convert.ToUInt16(invalidChars[ctr]):X4} ");
if ((ctr + 1) % 10 == 0) Console.WriteLine();
}
Console.WriteLine();
}
}
// The example displays the following output when run on a Windows system:
// Path.DirectorySeparatorChar: '\'
// Path.AltDirectorySeparatorChar: '/'
// Path.PathSeparator: ';'
// Path.VolumeSeparatorChar: ':'
// Path.GetInvalidPathChars:
// U+007C) U+0000) U+0001) U+0002) U+0003) U+0004) U+0005) U+0006) U+0007) U+0008)
// U+0009) U+000A) U+000B) U+000C) U+000D) U+000E) U+000F) U+0010) U+0011) U+0012)
// U+0013) U+0014) U+0015) U+0016) U+0017) U+0018) U+0019) U+001A) U+001B) U+001C)
// U+001D) U+001E) U+001F)
//
// The example displays the following output when run on a Linux system:
// Path.DirectorySeparatorChar: '/'
// Path.AltDirectorySeparatorChar: '/'
// Path.PathSeparator: ':'
// Path.VolumeSeparatorChar: '/'
// Path.GetInvalidPathChars:
// U+0000
Imports System.IO
Module Program
Sub Main()
Console.WriteLine($"Path.DirectorySeparatorChar: '{Path.DirectorySeparatorChar}'")
Console.WriteLine($"Path.AltDirectorySeparatorChar: '{Path.AltDirectorySeparatorChar}'")
Console.WriteLine($"Path.PathSeparator: '{Path.PathSeparator}'")
Console.WriteLine($"Path.VolumeSeparatorChar: '{Path.VolumeSeparatorChar}'")
Dim invalidChars = Path.GetInvalidPathChars()
Console.WriteLine($"Path.GetInvalidPathChars:")
For ctr As Integer = 0 To invalidChars.Length - 1
Console.Write($" U+{Convert.ToUInt16(invalidChars(ctr)):X4} ")
if (ctr + 1) Mod 10 = 0 Then Console.WriteLine()
Next
Console.WriteLine()
Console.WriteLine("Hello World!")
End Sub
End Module
' The example displays the following output when run on a Windows system:
' Path.DirectorySeparatorChar: '\'
' Path.AltDirectorySeparatorChar: '/'
' Path.PathSeparator: ';'
' Path.VolumeSeparatorChar: ':'
' Path.GetInvalidPathChars:
' U+007C) U+0000) U+0001) U+0002) U+0003) U+0004) U+0005) U+0006) U+0007) U+0008)
' U+0009) U+000A) U+000B) U+000C) U+000D) U+000E) U+000F) U+0010) U+0011) U+0012)
' U+0013) U+0014) U+0015) U+0016) U+0017) U+0018) U+0019) U+001A) U+001B) U+001C)
' U+001D) U+001E) U+001F)
'
' The example displays the following output when run on a Linux system:
' Path.DirectorySeparatorChar: '/'
' Path.AltDirectorySeparatorChar: '/'
' Path.PathSeparator: ':'
' Path.VolumeSeparatorChar: '/'
' Path.GetInvalidPathChars:
' U+0000
Comentários
Esse campo pode ter o mesmo valor de DirectorySeparatorChar .This field can have the same value as DirectorySeparatorChar. AltDirectorySeparatorChar e DirectorySeparatorChar são válidos para separar os níveis de diretório em uma cadeia de caracteres de caminho.AltDirectorySeparatorChar and DirectorySeparatorChar are both valid for separating directory levels in a path string.
O valor desse campo é uma barra ('/') em sistemas operacionais baseados em Windows e UNIX.The value of this field is a slash ('/') on both Windows and Unix-based operating systems.