Uri.ToString Method

Definition

Gets a canonical string representation for the current Uri.

public:
 virtual Platform::String ^ ToString() = ToString;
winrt::hstring ToString();
public string ToString();
function toString()
Public Function ToString () As String

Returns

String

Platform::String

winrt::hstring

The unescaped canonical representation of the current Uri. All characters are unescaped, except #, ?, and %.

Implements

Remarks

This ToString implementation is for the IStringable interface as implemented by the Uri class. IStringable is supported starting with Windows 8.1 and is also available in Windows Phone 8.1. The IStringable definition of ToString implementation is not literally an override of Platform::Object and its base API, but it does replace the ToString behavior.

For Windows 8 and Windows Phone 8, Uri does not implement IStringable (it's not available). So the ToString method of Uri remains the one that's implemented by Platform::Object or JavaScript "object" support for Windows Runtime. The apparent difference in origin of the ToString API is only visible for Visual C++ component extensions (C++/CX) and JavaScript, and you should consider it as an implementation detail that doesn't matter as far as how you use ToString in either case.

Applies to