C# Uri Uri(String, Boolean)
Description
Uri Uri(String, Boolean)
initializes a new instance
of the Uri class with the specified URI, with explicit control of character
escaping.
Syntax
Uri.Uri(String, Boolean)
has the following syntax.
[ObsoleteAttribute("The constructor has been deprecated. Please use new Uri(string). The dontEscape parameter is deprecated and is always false. http://go.microsoft.com/fwlink/?linkid=14202")]
public Uri(//from w w w . j av a 2 s . co m
string uriString,
bool dontEscape
)
Parameters
Uri.Uri(String, Boolean)
has the following parameters.
uriString
- The URI.dontEscape
- true if uriString is completely escaped; otherwise, false. See Remarks.
Example
The following example creates a Uri instance for the URI http://www.java2s.com/Hello%20World.htm. Because the contained URI is completely escaped and is in canonical form, the dontEscape parameter can be set to true.
/*w w w . j a v a 2 s . co m*/
using System;
public class MainClass{
public static void Main(String[] argv){
Uri myUri = new Uri("http://www.java2s.com/Hello%20World.htm", true);
System.Console.WriteLine(myUri);
}
}
The code above generates the following result.