Uri.IsBaseOf(Uri) 메서드

정의

현재 Uri 인스턴스가 지정된 Uri 인스턴스의 기본 URI인지 여부를 확인합니다.

public:
 bool IsBaseOf(Uri ^ uri);
public bool IsBaseOf (Uri uri);
member this.IsBaseOf : Uri -> bool
Public Function IsBaseOf (uri As Uri) As Boolean

매개 변수

uri
Uri

테스트하도록 지정된 URI입니다.

반환

Boolean

현재 true 인스턴스가 Uri의 기본 URI이면 uri이고, 그렇지 않으면 false입니다.

예외

uri이(가) null인 경우

예제

이 예제에서는 기본 Uri 인스턴스를 Uri 나타내는 인스턴스를 만듭니다. 그런 다음 문자열에서 두 번째 Uri 인스턴스를 만듭니다. IsBaseOf 호출하여 기본 인스턴스가 두 번째 인스턴스의 기반인지 여부를 확인합니다. 결과는 콘솔에 기록됩니다.

// Create a base Uri.
Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );

// Create a new Uri from a string.
Uri^ uriAddress = gcnew Uri( "http://www.contoso.com/index.htm?date=today" );

// Determine whether BaseUri is a base of UriAddress.  
if ( baseUri->IsBaseOf( uriAddress ) )
   Console::WriteLine( "{0} is the base of {1}", baseUri, uriAddress );
// Create a base Uri.
Uri baseUri = new Uri("http://www.contoso.com/");

// Create a new Uri from a string.
Uri uriAddress = new Uri("http://www.contoso.com/index.htm?date=today");

// Determine whether BaseUri is a base of UriAddress.
if (baseUri.IsBaseOf(uriAddress))
    Console.WriteLine("{0} is the base of {1}", baseUri, uriAddress);
// Create a base Uri.
let baseUri = Uri "http://www.contoso.com/"

// Create a new Uri from a string.
let uriAddress = Uri "http://www.contoso.com/index.htm?date=today"

// Determine whether BaseUri is a base of UriAddress.
if baseUri.IsBaseOf uriAddress then
    printfn $"{baseUri} is the base of {uriAddress}"
' Create a base Uri.
Dim baseUri As New Uri("http://www.contoso.com/")

' Create a new Uri from a string.
Dim uriAddress As New Uri("http://www.contoso.com/index.htm?date=today")

' Determine whether BaseUri is a base of UriAddress.  
If baseUri.IsBaseOf(uriAddress) Then
    Console.WriteLine("{0} is the base of {1}", baseUri, uriAddress)
End If

설명

IsBaseOf 는 현재 Uri 인스턴스를 지정된 인스턴스와 비교하여 이 URI가 지정된 Uri 인스턴스의 Uri기반인지 여부를 확인하는 데 사용됩니다. 두 Uri 개체를 비교하여 기본 관계를 결정할 때 사용자 정보(UserInfo)는 평가되지 않습니다. 두 URI(uri1 및 uri2)를 비교할 때 uri1은 마지막 슬래시(/) 이후 uri2의 모든 항목을 무시하면 두 URI가 동일한 경우 uri2의 기반이 됩니다. 다음 표에서는 기본 URI로 사용하여 http://host/path/path/file?query 다른 URI의 기본 URI인지 여부를 보여 줍니다.

URI http://host/path/path/file?query 은 다음의 기본입니다.
http://host/path/path/file/
http://host/path/path/#fragment
http://host/path/path/MoreDir/"
http://host/path/path/OtherFile?Query
http://host/path/path/
http://host/path/path/file
http://host/path/path 아니요
http://host/path/path?query 아니요
http://host/path/path#Fragment 아니요
http://host/path/path2/ no
://host/path/path2/MoreDir no
http://host/path/File no

적용 대상