Uri.IsBaseOf 메서드
어셈블리: System(system.dll)
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에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.