Uri.IsUnc Uri.IsUnc Uri.IsUnc Uri.IsUnc Property

定義

指定した Uri が UNC (Universal Naming Convention) パスかどうかを示す値を取得します。Gets whether the specified Uri is a universal naming convention (UNC) path.

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

プロパティ値

Boolean が UNC パスの場合は true 値が Uri。それ以外の場合は falseA Boolean value that is true if the Uri is a UNC path; otherwise, false.

例外

このインスタンスは相対 URI を表します。このプロパティは、絶対 URI でのみ有効です。This instance represents a relative URI, and this property is valid only for absolute URIs.

次の例では、作成、Uriインスタンス化し、UNC パスであるかどうかを決定します。The following example creates a Uri instance and determines whether it is a UNC path.

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

注釈

IsUncプロパティはtrue場合、指定したUriインスタンスが UNC パス (など\\server\folder または file://server/folder)。The IsUnc property is true if the specified Uri instance is a UNC path (such as \\server\folder or file://server/folder). このプロパティは常に返しますtrue場合は、URI が file:// スキームし、ホストのコンポーネントを指定します。This property always returns true if the URI has the file:// scheme and specifies a host component.

適用対象