Freigeben über


Uri.LocalPath-Eigenschaft

Ruft die Darstellung eines Dateinamens im lokalen Betriebssystem ab.

Namespace: System
Assembly: System (in system.dll)

Syntax

'Declaration
Public ReadOnly Property LocalPath As String
'Usage
Dim instance As Uri
Dim value As String

value = instance.LocalPath
public string LocalPath { get; }
public:
property String^ LocalPath {
    String^ get ();
}
/** @property */
public String get_LocalPath ()
public function get LocalPath () : String

Eigenschaftenwert

Ein String mit der Darstellung eines Dateinamens im lokalen Betriebssystem.

Ausnahmen

Ausnahmetyp Bedingung

InvalidOperationException

Diese Instanz stellt einen relativen URI dar, diese Eigenschaft ist jedoch nur für absolute URIs gültig.

Hinweise

Der von dieser Eigenschaft zurückgegebene Wert ist nicht mit Escapezeichen versehen. Wenn der Pfad als Windows-Dateipfad erkannt wird, werden alle Schrägstriche (/) durch umgekehrte Schrägstriche (\) ersetzt.

Für den URI file://computer/file.ext ist der absolute Pfad /file.ext, und der lokale Pfad ist \\computer\file.ext.

Beispiel

Das folgende Beispiel erstellt eine Uri-Instanz und gibt den lokalen Pfad auf der Konsole aus.

    Dim uriAddress2 As New Uri("file://server/filename.ext")
    Console.WriteLine(uriAddress2.LocalPath)
    Console.WriteLine("Uri {0} a UNC path", IIf(uriAddress2.IsUnc, "is", "is not")) 'TODO: For performance reasons this should be changed to nested IF statements
    Console.WriteLine("Uri {0} a local host", IIf(uriAddress2.IsLoopback, "is", "is not")) 'TODO: For performance reasons this should be changed to nested IF statements
    Console.WriteLine("Uri {0} a file", IIf(uriAddress2.IsFile, "is", "is not")) 'TODO: For performance reasons this should be changed to nested IF statements

End Sub 'GetParts
Uri uriAddress2 =  new Uri("file://server/filename.ext");
Console.WriteLine(uriAddress2.LocalPath);
Console.WriteLine("Uri {0} a UNC path", uriAddress2.IsUnc ? "is" : "is not");
Console.WriteLine("Uri {0} a local host", uriAddress2.IsLoopback ? "is" : "is not");
Console.WriteLine("Uri {0} a file", uriAddress2.IsFile ? "is" : "is not");

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

Uri-Klasse
Uri-Member
System-Namespace