Uri.IsBaseOf メソッドとは? わかりやすく解説

Uri.IsBaseOf メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

現在の Uri インスタンスが、指定した Uriベースかどうか判断します

名前空間: System
アセンブリ: System (system.dll 内)
構文構文

解説解説

IsBaseOf使用して指定した Uri現在の Uri インスタンス比較し、この URI が、指定した Uriベースであるかどうか判断します2 つUri オブジェクト比較してベース関係を判断する場合ユーザー情報 (UserInfo) は評価されません。2 つURI (uri1 と uri2) の比較で、最後スラッシュ後ろをすべて無視した場合にこれら 2 つURI が同じであるときは、uri1 は uri2 のベースです。次の表では、http://host/path/path/file?queryベース URI として使用し、この URI が他の URIベースであるかどうか示します

URI

http://host/path/path/file?query次の URIベースかどうか

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 インスタンス作成しますまた、文字列から 2 つ目の Uri インスタンス作成します。さらに、IsBaseOf呼び出してベース インスタンス2 つ目のインスタンスベースであるかどうか判断します結果コンソール出力されます。

' 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
// 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);
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Uri.IsBaseOf メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Uri.IsBaseOf メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS