AnyUri.GetComponents MethodAnyUri.GetComponents MethodAnyUri::GetComponents Method

Gets the specified components of the current instance, using the specified escaping.

Syntax

Public Function GetComponents( _
    components As UriComponents, _
    format As UriFormat _
) As String
public string GetComponents(
    UriComponents components,
    UriFormat format
)
public:
String^ GetComponents(
    UriComponents components, 
    UriFormat format
)
 

Parameters

components

Type: System.UriComponentsSystem.UriComponentsSystem::UriComponents

A bitwise combination of the UriComponentsUriComponentsUriComponents values that specifies which parts of the current instance to return.

format

Type: System.UriFormatSystem.UriFormatSystem::UriFormat

One of the UriFormatUriFormatUriFormat values that controls how special characters are escaped.

Return Value

Type: System.StringSystem.StringSystem::String^

A stringStringString value that contains the components.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionArgumentOutOfRangeExceptionArgumentOutOfRangeException components is not a combination of valid UriComponentsUriComponentsUriComponents values or format is not one of the UriFormatUriFormatUriFormat values. The AbsoluteUriAbsoluteUriAbsoluteUri value will not necessarily return an absolute URI, but will contain all the components that are present in the current instance.

Remarks

Unlike GetComponentsGetComponentsGetComponents, relative URIs can be used with this method. In this case only the components that are present in the URI are returned. The KeepDelimiterKeepDelimiterKeepDelimiter and SerializationInfoStringSerializationInfoStringSerializationInfoString are ignored.

The components returned are normalized as follows:

  • Case normalization of URI scheme, and percent-encoded values.
  • Omission of default ports for some schemes (eg. port 21 for the ftp: scheme).
  • Resolution of dot-segments (.. and . path segments).
  • Normalization of '/' and '\' characters in file: paths residing on localhost.

Other than the set of characters that are escaped, this method behaves like the GetComponentsGetComponentsGetComponents method with the