C#-এ Uri.IsBaseOf() মেথডটি বর্তমান URI ইনস্ট্যান্সটি নির্দিষ্ট URI ইনস্ট্যান্সের বেস (ভিত্তি) কিনা তা নির্ধারণ করে।
সিনট্যাক্স
public bool IsBaseOf (Uri uri);
উদাহরণ ১
একই ডোমেনের URI তুলনা, যেখানে newURI1, newURI2-এর বেস।
using System;
public class Demo {
public static void Main(){
Uri newURI1 = new Uri("https://www.tutorialspoint.com/index.htm");
Console.WriteLine("URI = " + newURI1);
Uri newURI2 = new Uri("https://www.tutorialspoint.com/");
Console.WriteLine("URI = " + newURI2);
if(newURI1.Equals(newURI2))
Console.WriteLine("Both the URIs are equal!");
else
Console.WriteLine("Both the URIs aren't equal!");
if(newURI1.IsBaseOf(newURI2))
Console.WriteLine("newURI1 is the base address");
else
Console.WriteLine("newURI1 isn't the base address");
}
}
আউটপুট
URI = https://www.tutorialspoint.com/index.htm URI = https://www.tutorialspoint.com/ Both the URIs aren't equal! newURI1 is the base address
উদাহরণ ২
বিভিন্ন ডোমেনের URI তুলনা, যেখানে newURI1, newURI2-এর বেস নয়।
using System;
public class Demo {
public static void Main(){
Uri newURI1 = new Uri("https://www.tutorialspoint.com/index.htm");
Console.WriteLine("URI = " + newURI1);
Uri newURI2 = new Uri("https://www.qries.com/");
Console.WriteLine("URI = " + newURI2);
if(newURI1.Equals(newURI2))
Console.WriteLine("Both the URIs are equal!");
else
Console.WriteLine("Both the URIs aren't equal!");
if(newURI1.IsBaseOf(newURI2))
Console.WriteLine("newURI1 is the base address");
else
Console.WriteLine("newURI1 isn't the base address");
}
}
আউটপুট
URI = https://www.tutorialspoint.com/index.htm URI = https://www.qries.com/ Both the URIs aren't equal! newURI1 isn't the base address