Freigeben über


Path.PathSeparator-Feld

Ein plattformspezifisches Trennzeichen, das zur Trennung von Pfadzeichenfolgen in Ungebungsvariablen verwendet wird.

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared ReadOnly PathSeparator As Char
'Usage
Dim value As Char

value = Path.PathSeparator
public static readonly char PathSeparator
public:
static initonly wchar_t PathSeparator
public static final char PathSeparator
public static final var PathSeparator : char

Hinweise

Auf Desktopplattformen auf Grundlage von Windows ist der Wert dieses Felds in der Standardeinstellung das Semikolon (;), andere Plattformen können jedoch ein anderes Zeichen verwenden.

Beispiel

Im folgenden Codebeispiel wird die Verwendung des PathSeparator-Felds veranschaulicht.

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()

' This code produces output similar to the following:
' Note that the InvalidPathCharacters contain characters
' outside of the printable character set.
'
' Path.AltDirectorySeparatorChar=/
' Path.DirectorySeparatorChar=\
' Path.PathSeparator=;
' Path.VolumeSeparatorChar=:
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();
// This code produces output similar to the following:
// Note that the InvalidPathCharacters contain characters
// outside of the printable character set.
//
// Path.AltDirectorySeparatorChar=/
// Path.DirectorySeparatorChar=\
// Path.PathSeparator=;
// Path.VolumeSeparatorChar=:
Console::WriteLine( "Path::AltDirectorySeparatorChar={0}", (Path::AltDirectorySeparatorChar).ToString() );
Console::WriteLine( "Path::DirectorySeparatorChar={0}", (Path::DirectorySeparatorChar).ToString() );
Console::WriteLine( "Path::PathSeparator={0}", (Path::PathSeparator).ToString() );
Console::WriteLine( "Path::VolumeSeparatorChar={0}", (Path::VolumeSeparatorChar).ToString() );
Console::Write( "Path::InvalidPathChars=" );
for ( int i = 0; i < Path::InvalidPathChars->Length; i++ )
   Console::Write( Path::InvalidPathChars[ i ] );
Console::WriteLine();
Console.WriteLine("Path.AltDirectorySeparatorChar={0}", 
    System.Convert.ToString(Path.AltDirectorySeparatorChar));
Console.WriteLine("Path.DirectorySeparatorChar={0}", 
    System.Convert.ToString(Path.DirectorySeparatorChar));
Console.WriteLine("Path.PathSeparator={0}", 
    System.Convert.ToString(Path.PathSeparator));
Console.WriteLine("Path.VolumeSeparatorChar={0}", 
    System.Convert.ToString (Path.VolumeSeparatorChar));

Console.Write("Path.InvalidPathChars=");

for(int iCtr=0; iCtr<Path.InvalidPathChars.length;iCtr++) {
    char c = Path.InvalidPathChars[iCtr];
    Console.Write(c);
}
Console.WriteLine();
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=");
for (var c : char in Path.InvalidPathChars)
    Console.Write(c);
Console.WriteLine();

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

Path-Klasse
Path-Member
System.IO-Namespace

Weitere Ressourcen

Datei- und Stream-E/A
Gewusst wie: Lesen aus einer Textdatei
Gewusst wie: Schreiben von Text in eine Datei