이 항목은 아직 평가되지 않았습니다.- 이 항목 평가

Uri.IsBaseOf 메서드

참고: 이 메서드는 .NET Framework 버전 2.0에서 새로 추가되었습니다.

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

네임스페이스: System
어셈블리: System(system.dll)

public bool IsBaseOf (
	Uri uri
)
public boolean IsBaseOf (
	Uri uri
)
public function IsBaseOf (
	uri : Uri
) : boolean

매개 변수

uri

테스트할 지정된 Uri 인스턴스입니다.

반환 값

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

IsBaseOf는 현재 Uri 인스턴스와 지정된 Uri를 비교하여 이 URI가 지정된 Uri의 기본 URI인지 여부를 확인하는 데 사용됩니다. 두 가지 Uri 개체를 비교하여 기본 관계를 확인하는 경우 사용자 정보(UserInfo)는 확인되지 않습니다. 두 URI(uri1 및 uri2)를 비교할 때 uri2에서 마지막 슬래시(/) 뒤의 모든 것을 무시하는 경우 두 URI가 같으면 uri1은 uri2의 기본 URI입니다. http://host/path/path/file?query를 기본 URI로 사용하는 경우 다음 표에서는 이 URI가 다른 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/

아니요

http://host/path/path2/MoreDir

아니요

http://host/path/File

아니요

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

// 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);

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

.NET Framework

2.0에서 지원

.NET Compact Framework

2.0에서 지원
이 정보가 도움이 되었습니까?
(1500자 남음)

커뮤니티 추가 항목

추가
© 2013 Microsoft. All rights reserved.