CheckSchemeName Method

Uri.CheckSchemeName Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Determines whether the specified scheme name is valid.

Namespace:  System
Assembly:  System (in System.dll)

public static bool CheckSchemeName(
	string schemeName
)

Parameters

schemeName
Type: System.String
The scheme name to validate.

Return Value

Type: System.Boolean
A Boolean value that is true if the scheme name is valid; otherwise, false.

This method checks the scheme name for validity according to RFC 3986. The scheme name must begin with a letter and must contain only letters, digits, and the characters ".", "+", or "-".

The following example creates a Uri instance and checks whether the scheme name is valid.


Uri address3 = new Uri("http://www.contoso.com/index.htm#search");
if (Uri.CheckSchemeName(address3.Scheme))
    outputBlock.Text += "address has a valid scheme name\n";
else    
    outputBlock.Text += "address does not has a valid scheme name\n";

if (address3.Scheme == Uri.UriSchemeHttp)
    outputBlock.Text += "Uri is HTTP type\n";
          


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft