Convert String to URI

Levu

Well-known member
Joined
Jun 13, 2007
Messages
51
Location
Norway - Drammen
Programming Experience
1-3
Never mind, found out about it..

Dim url as new uri("string")

^^

Or not..
 
Last edited:
One of the constructors (as New Uri(...)) or the shared TryCreate method.
 
"http://www.googoo.com" would be more appropriate, if you didn't have a different protocol in mind.

More of the point, the constructor will as you know throw exception if input isn't valid (your string), the TryCreate returns boolean value indicating success without throwing exception, so using the constructor is better when you know the input fits, TryCreate better when you need to validate unknown input.
 
Back
Top