C# Uri IsBaseOf
Description
Uri IsBaseOf
determines whether the current Uri instance
is a base of the specified Uri instance.
Syntax
Uri.IsBaseOf
has the following syntax.
public bool IsBaseOf(
Uri uri
)
Parameters
Uri.IsBaseOf
has the following parameters.
uri
- The specified Uri instance to test.
Returns
Uri.IsBaseOf
method returns true if the current Uri instance is a base of uri; otherwise, false.
Example
This example creates a Uri instance that represents a base Uri instance.
// www . j a v a 2 s . co m
using System;
public class MainClass{
public static void Main(String[] argv){
// Create a base Uri.
Uri baseUri = new Uri("http://www.java2s.com/");
// Create a new Uri from a string.
Uri uriAddress = new Uri("http://www.java2s.com/index.htm?date=today");
// Determine whether BaseUri is a base of UriAddress.
if (baseUri.IsBaseOf(uriAddress))
Console.WriteLine("{0} is the base of {1}", baseUri, uriAddress);
}
}
The code above generates the following result.