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

Uri.ToString メソッド

指定した Uri インスタンスの正規文字列形式を返します。

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

解説解説
使用例使用例

文字列から新しい Uri インスタンスを作成する例を次に示します。この例では、コンストラクタに渡した文字列を返す OriginalString の戻り値と、正規形式の文字列を返す ToString の呼び出しの戻り値の相違を示します。

    ' Create a new Uri from a string address.
    Dim uriAddress As New
 Uri("HTTP://www.Contoso.com:80//thick%20and%20thin.htm")
    
    ' Write the new Uri to the console and note the difference in the
 two values.
    ' ToString() gives the canonical version.  OriginalString gives
 the orginal 
    ' string that was passed to the constructor.
    ' The following outputs "http://www.contoso.com/thick and thin.htm".
    Console.WriteLine(uriAddress.ToString())
    
    ' The following outputs "HTTP://www.Contoso.com:80//thick%20and%20thin.htm".
    Console.WriteLine(uriAddress.OriginalString)

End Sub 'SampleToString
// Create a new Uri from a string address.
Uri uriAddress = new Uri("HTTP://www.Contoso.com:80//thick%20and%20thin.htm");

// Write the new Uri to the console and note the difference in the two
 values.
// ToString() gives the canonical version.  OriginalString gives the
 orginal 
// string that was passed to the constructor.

// The following outputs "http://www.contoso.com/thick and thin.htm".
Console.WriteLine(uriAddress.ToString()); 

// The following outputs "HTTP://www.Contoso.com:80//thick%20and%20thin.htm".
Console.WriteLine(uriAddress.OriginalString);
.NET Framework のセキュリティ.NET Framework のセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「Uri.ToString メソッド」の関連用語

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

   

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



Uri.ToString メソッドのページの著作権

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

©2026 GRAS Group, Inc.RSS