Uri.ToString Method


Gets a canonical string representation for the current Uri.

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



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



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