UriParser.GetComponents(Uri, UriComponents, UriFormat) 方法

定義

從 URI 取得元件。

protected:
 virtual System::String ^ GetComponents(Uri ^ uri, UriComponents components, UriFormat format);
protected virtual string GetComponents (Uri uri, UriComponents components, UriFormat format);
abstract member GetComponents : Uri * UriComponents * UriFormat -> string
override this.GetComponents : Uri * UriComponents * UriFormat -> string
Protected Overridable Function GetComponents (uri As Uri, components As UriComponents, format As UriFormat) As String

參數

uri
Uri

要剖析的 URI。

components
UriComponents

要從 uri 擷取的 UriComponents

format
UriFormat

UriFormat 值之一,控制特殊字元的逸出方式。

傳回

String

包含元件的字串。

例外狀況

uriFormat 無效。

-或- uriComponents 不是有效 UriComponents 值的結合。

uri 需要使用者驅動的剖析。 -或- uri 不是絕對 URI。 相對 URI 不能用於這個方法。

備註

GetComponents使用 方法來判斷 URI 的各個部分的值,例如 SchemeHostPort

元件會依照它們出現在 URI 中的順序傳回。 例如,如果 Scheme 已指定 ,則會先顯示。

適用於

另請參閱