Uri.ToString メソッド
アセンブリ: System (system.dll 内)

Dim instance As Uri Dim returnValue As String returnValue = instance.ToString
エスケープ解除された正規形式の Uri インスタンスを格納している String インスタンス。#、?、および % 以外のすべての文字は、エスケープ解除されます。

ポートがスキームの既定ポートである場合、このメソッドで返される文字列にはポート情報が含まれません。
![]() |
---|
ToString メソッドで返される文字列には、コンソール アプリケーションの状態を破損させる制御文字が含まれることがあります。返される文字列から制御文字を削除するには、GetComponents メソッドを UriFormat.SafeUnescaped 形式で使用します。 |

文字列から新しい 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);


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からUri.ToString メソッドを検索する場合は、下記のリンクをクリックしてください。

- Uri.ToString メソッドのページへのリンク