C# में Uri.IsBaseOf() मेथड का उपयोग यह निर्धारित करने के लिए किया जाता है कि वर्तमान Uri इंस्टेंस निर्दिष्ट Uri इंस्टेंस का बेस है या नहीं।
सिंटैक्स
निम्नलिखित सिंटैक्स है:
public bool IsBaseOf (Uri uri);
ऊपर, पैरामीटर 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("दोनों URIs समान हैं!");
else
Console.WriteLine("दोनों URIs समान नहीं हैं!");
if(newURI1.IsBaseOf(newURI2))
Console.WriteLine("newURI1 बेस एड्रेस है");
else
Console.WriteLine("newURI1 बेस एड्रेस नहीं है");
}
}
आउटपुट
यह निम्नलिखित आउटपुट देगा:
URI = https://www.tutorialspoint.com/index.htm URI = https://www.tutorialspoint.com/ दोनों URIs समान नहीं हैं! newURI1 बेस एड्रेस है
उदाहरण
आइए अब 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("दोनों URIs समान हैं!");
else
Console.WriteLine("दोनों URIs समान नहीं हैं!");
if(newURI1.IsBaseOf(newURI2))
Console.WriteLine("newURI1 बेस एड्रेस है");
else
Console.WriteLine("newURI1 बेस एड्रेस नहीं है");
}
}
आउटपुट
यह निम्नलिखित आउटपुट देगा:
URI = https://www.tutorialspoint.com/index.htm URI = https://www.qries.com/ दोनों URIs समान नहीं हैं! newURI1 बेस एड्रेस नहीं है