Uri.IsUnc 속성

정의

지정된 Uri가 UNC(범용 명명 규칙) 경로인지 여부를 나타내는 값을 가져옵니다.Gets a value that indicates 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

<see langword="true" /> if the <see cref="T:System.Uri" /> is a UNC path; otherwise, <see langword="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 ,//server 또는) 이면 속성은입니다 file://server/folder .The IsUnc property is true if the specified Uri instance is a UNC path (such as \\server\folder, //server, or file://server/folder). trueURI에 file://체계가 있고 호스트 구성 요소를 지정 하는 경우이 속성은 항상를 반환 합니다.This property always returns true if the URI has the file:// scheme and specifies a host component.

적용 대상