C# में Uri.IsBaseOf () विधि का उपयोग यह निर्धारित करने के लिए किया जाता है कि क्या वर्तमान उरी इंस्टेंस निर्दिष्ट उरी इंस्टेंस का आधार है।
सिंटैक्स
निम्नलिखित वाक्य रचना है -
public bool IsBaseOf (Uri uri);
ऊपर, पैरामीटर उरी परीक्षण के लिए निर्दिष्ट उरी उदाहरण है।
उदाहरण
आइए अब Uri.IsBaseOf() विधि को लागू करने के लिए एक उदाहरण देखें -
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.IsBaseOf() विधि को लागू करने के लिए एक और उदाहरण देखें -
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