Home » C#

C# | Uri.IsBaseOf() Method with Example

Uri.IsBaseOf() Method: Here, we are going to learn about the IsBaseOf() method of Uri class with example in C#.
Submitted by Nidhi, on March 26, 2020

Uri.IsBaseOf() Method

Uri.IsBaseOf() method is an instance method, which is used to check an object of Uri is the base of another object of Uri class. This method returns a boolean value, if the current object is base on a specified object then it returns true otherwise it returns false.

Syntax:

    bool Uri.IsBaseOf(Uri uri);

Parameter(s):

  • Uri uri – represents the object that may be base of current object.

Return value:

The return type of this method is boolean, if current object is base of specified object then it returns true otherwise it returns false.

Example to demonstrate example of Uri.IsBaseOf() method

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {
        // Create some Uri objects
        Uri uri1 = new Uri("https://www.includehelp.com/");
        Uri uri2 = new Uri("https://www.duggu.com/");

        // Create a new Uri to check above uri are base of this uri or not.
        Uri newUri = new Uri("https://www.includehelp.com/C#_Article.aspx");

        //here we will check given uri is base of another Uri.
        if (uri1.IsBaseOf(newUri))
            Console.WriteLine("uri1 is baseof newUri");
        else
            Console.WriteLine("uri1 is not baseof newUri");

        if (uri2.IsBaseOf(newUri))
            Console.WriteLine("uri2 is baseof newUri");
        else
            Console.WriteLine("uri2 is not baseof newUri");
    }
}

Output

uri1 is baseof newUri
uri2 is not baseof newUri





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.