Uri.IsFile Uri.IsFile Uri.IsFile Uri.IsFile Property

Definition

Ruft einen Wert ab, der angibt, ob der angegebene Uri ein Datei-URI ist.Gets a value indicating whether the specified Uri is a file URI.

public:
 property bool IsFile { bool get(); };
public bool IsFile { get; }
member this.IsFile : bool
Public ReadOnly Property IsFile As Boolean

Eigenschaftswert

Ein Boolean-Wert, der true ist, wenn der Uri einen Datei-URI darstellt, andernfalls false.A Boolean value that is true if the Uri is a file URI; otherwise, false.

Ausnahmen

Diese Instanz stellt einen relativen URI dar, diese Eigenschaft ist jedoch nur für absolute URIs gültig.This instance represents a relative URI, and this property is valid only for absolute URIs.

Beispiele

Das folgende Beispiel erstellt eine Uri Instanz, und bestimmt, ob es sich um ein Datei-URI ist.The following example creates a Uri instance and determines whether it is a file URI.

Uri^ uriAddress2 = gcnew Uri( "file://server/filename.ext" );
Console::WriteLine( uriAddress2->LocalPath );
Console::WriteLine( "Uri {0} a UNC path", uriAddress2->IsUnc ? (String^)"is" : "is not" );
Console::WriteLine( "Uri {0} a local host", uriAddress2->IsLoopback ? (String^)"is" : "is not" );
Console::WriteLine( "Uri {0} a file", uriAddress2->IsFile ? (String^)"is" : "is not" );
// The example displays the following output:
//    \\server\filename.ext
//    Uri is a UNC path
//    Uri is not a local host
//    Uri is a file
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");
// The example displays the following output:
//    \\server\filename.ext
//    Uri is a UNC path
//    Uri is not a local host
//    Uri is a file
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
' The example displays the following output:
'    \\server\filename.ext
'    Uri is a UNC path
'    Uri is not a local host
'    Uri is a file

Hinweise

Die IsFile Eigenschaft true bei der Scheme -Eigenschaft gleich UriSchemeFile.The IsFile property is true when the Scheme property equals UriSchemeFile.

Gilt für: