কম্পিউটার

C# এ Uri.MakeRelativeUri(Uri) পদ্ধতি


C# এ Uri.MakeRelativeUri(Uri) পদ্ধতি দুটি Uri দৃষ্টান্তের মধ্যে পার্থক্য নির্ণয় করতে ব্যবহৃত হয়।

সিনট্যাক্স

নিম্নলিখিত বাক্য গঠন −

public Uri MakeRelativeUri (Uri uri);

উপরে, বর্তমান URI-এর সাথে তুলনা করার জন্য URI হল URI।

উদাহরণ

আসুন এখন Uri.MakeRelativeUri(Uri) পদ্ধতি প্রয়োগ করার জন্য একটি উদাহরণ দেখি -

using System;
public class Demo {
   public static void Main(){
      Uri newURI1 = new Uri("https://www.tutorialspoint.com/");
      Console.WriteLine("URI = "+newURI1);
      Uri newURI2 = new Uri("https://www.tutorialspoint.com/java.htm");
      Console.WriteLine("URI = "+newURI2);
      if(newURI1.Equals(newURI2))
         Console.WriteLine("Both the URIs are equal!");
      else
         Console.WriteLine("Both the URIs aren't equal!");
      Uri res = newURI1.MakeRelativeUri(newURI2);
      Console.WriteLine("Relative uri = "+res);
   }
}

আউটপুট

এটি নিম্নলিখিত আউটপুট −

তৈরি করবে
URI = https://www.tutorialspoint.com/
URI = https://www.tutorialspoint.com/java.htm
Both the URIs aren't equal!
Relative uri = java.htm

উদাহরণ

এখন Uri.MakeRelativeUri(Uri) পদ্ধতি প্রয়োগ করার জন্য আরেকটি উদাহরণ দেখা যাক -

using System;
public class Demo {
   public static void Main(){
      Uri newURI1 = new Uri("https://www.tutorialspoint.com/");
      Console.WriteLine("URI = "+newURI1);
      Uri newURI2 = new Uri("https://www.tutorialspoint.com/jquery.htm#abcd");
      Console.WriteLine("URI = "+newURI2);
      if(newURI1.Equals(newURI2))
         Console.WriteLine("Both the URIs are equal!");
      else
         Console.WriteLine("Both the URIs aren't equal!");
      Uri res = newURI1.MakeRelativeUri(newURI2);
      Console.WriteLine("Relative uri = "+res);
   }
}

আউটপুট

এটি নিম্নলিখিত আউটপুট −

তৈরি করবে
URI = https://www.tutorialspoint.com/
URI = https://www.tutorialspoint.com/jquery.htm#abcd
Both the URIs aren't equal!
Relative uri = jquery.htm#abcd

  1. সি# এ সিকোয়েন্স সমান পদ্ধতি

  2. C# এ সামগ্রিক পদ্ধতি

  3. C# () এ TakeWhile পদ্ধতি

  4. C# এ GroupBy() পদ্ধতি