Uri.OriginalString プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Uri.OriginalString プロパティの意味・解説 

Uri.OriginalString プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

Uri コンストラクタに渡された元の URI 文字列を取得します。

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

Dim instance As Uri
Dim value As String

value = instance.OriginalString
public string OriginalString { get;
 }
public:
property String^ OriginalString {
    String^ get ();
}
/** @property */
public String get_OriginalString ()
public function get OriginalString
 () : String

プロパティ値
このインスタンスの作成時に指定した URI 自体を含む String。それ以外の場合は Empty。

例外例外
例外の種類条件

InvalidOperationException

このインスタンスは相対 URI を表します。このプロパティは、絶対 URI でのみ有効です。

解説解説

コンストラクタに指定した URI に先行または後続の空白文字が含まれる場合、これらの空白文字は保持されます。

このプロパティからの戻り値は、ToString および AbsoluteUri とは異なります。 ToString からは、エスケープ解除された正規形式の URI が返されます。AbsoluteUri からは、エスケープされた正規形式の URI が返されます。

使用例使用例

文字列から新しい 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 'SampleOriginalString
// 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);
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

Uri.OriginalString プロパティのお隣キーワード
検索ランキング

   

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



Uri.OriginalString プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS