C# | Uri.IsBaseOf(Uri) Method
Uri.IsBaseOf(Uri) Method is used to determine whether the current Uri instance is a base of the specified Uri instance.
Syntax: public bool IsBaseOf (Uri uri);
Here, it takes the specified Uri instance to test.Return Value: This method returns true if the current Uri instance is a base of uri otherwise, false.
Exception: This method throws ArgumentNullException if uri is null.
Below programs illustrate the use of Uri.IsBaseOf(Uri) Method:
Example 1:
// C# program to demonstrate the // Uri.IsBaseOf(Uri) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring and initializing address1 // Declaring and intializing address2 // using IsBaseOf() method bool value = address1.IsBaseOf(address2); // Displaying the result if (value) Console.WriteLine("address1 instance is a base"+ " of the specified address2"); else Console.WriteLine("address1 instance is not a "+ "base of the specified address2"); } } |
address1 instance is a base of the specified address2
Example 2:
// C# program to demonstrate the // Uri.IsBaseOf(Uri) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // calling get() method } // defining get() method public static void get(Uri address1, Uri address2) { // using IsBaseOf() method bool value = address1.IsBaseOf(address2); // Displaying the result if (value) Console.WriteLine("address1 instance is a "+ "base of the specified address2"); else Console.WriteLine("address1 instance is "+ "not a base of the specified address2"); } } |
address1 instance is a base of the specified address2 address1 instance is not a base of the specified address2
Reference:
Recommended Posts:
- Difference between Method Overriding and Method Hiding in C#
- C# | IsNullOrEmpty() Method
- C# | Uri.FromHex() Method
- C# | Replace() Method
- C# | Join Method | Set - 2
- Stack.Contains() Method in C#
- C# | Method Parameters
- C# | Insert() Method
- C# | Random.Next() Method
- C# | Uri.IsHexDigit() Method
- C# | IndexOfAny() Method
- C# | String.Contains() Method
- C# | Remove() Method
- C# | Math.Tan() Method
- C# | Math.Cos() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



