To create a Uri from a string you can do this:
Uri u = new Uri(\"example.com\");
But the problem is if the string (like the one above) does
You could also use UriBuilder:
public static Uri GetUri(this string s)
{
return new UriBuilder(s).Uri;
}
Remarks from MSDN:
This constructor initializes a new instance of the UriBuilder class with the Fragment, Host, Path, Port, Query, Scheme, and Uri properties set as specified in uri.
If uri does not specify a scheme, the scheme defaults to "http:".