Uri.Uri(String) constructor

Applies to Windows and Windows Phone

Creates a Uniform Resource Identifier (URI) from the specified string.

Syntax


public:
Uri(
  String^ uri
)

Parameters

uri

Type: String [JavaScript] | Platform::String [C++]

The string from which the URI is created.

Examples

This example creates a URI that uses the http protocol to access a website.


// The URI string
var uriToLaunch = L"http://www.bing.com";

// Create a Uri object from the URI string
auto uri = ref new Windows::Foundation::Uri(uriToLaunch);

This example creates a URI that uses the ms-appx protocol to access an image file in the app package.


// The URI string
var uriImage = "ms-appx:///images/SecondaryTileDefault-sdk.png";

// Create a Uri object from the URI string
auto uri = ref new Windows::Foundation::Uri(uriImage);

This example creates a URI that uses the ms-appdata protocol to access a file in local app data store for your app.


// The URI string
var uriFile = "ms-appdata:///local/file.ext";

// Create a Uri object from the URI string
auto uri = ref new Windows::Foundation::Uri(uriFile);

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.Foundation
Windows::Foundation [C++]

Metadata

Windows.winmd

See also

Uri
Uri(String, String)

 

 

Show:
© 2014 Microsoft