C# Uri TryCreate(Uri, String, Uri)
Description
Uri TryCreate(Uri, String, Uri)
creates a new Uri using
the specified base and relative String instances.
Syntax
Uri.TryCreate(Uri, String, Uri)
has the following syntax.
public static bool TryCreate(
Uri baseUri,/*w w w. j a va 2 s .c o m*/
string relativeUri,
out Uri result
)
Parameters
Uri.TryCreate(Uri, String, Uri)
has the following parameters.
baseUri
- The base Uri.relativeUri
- The relative Uri, represented as a String, to add to the base Uri.result
- When this method returns, contains a Uri constructed from baseUri and relativeUri. This parameter is passed uninitialized.
Returns
Uri.TryCreate(Uri, String, Uri)
method returns A Boolean value that is true if the Uri was successfully created; otherwise,
false.
Example
/*from www. j a v a 2 s.c om*/
using System;
public class MainClass{
public static void Main(String[] argv){
Uri uri = new Uri("http://java2s.com");
String relative = "asd.htm";
Uri result = null;
Uri.TryCreate(uri,relative,out result);
System.Console.WriteLine(result);
}
}
The code above generates the following result.