Uniform resource identifier (Uri) is a compact representation of a resource available to our application on the internet. It can link us to an image, a webpage, a pdf file, etc.
The GetType()
method is an override method that returns the current type of the Uri object. It is helpful when we need to be sure if a Uri object is actually a Uri object.
Uri.GetType()
Uri
: This is the Uri object that we want to get the current type of.
It returns the type of the current object.
using System;class HelloWorld{static void Main(){// Create some Uri objectsUri uri1 = new Uri("https://www.educative.io/");Uri uri2 = new Uri("https://www.educative.io/");Uri uri3 = new Uri("https://www.educative.io/index.html");Uri uri4 = new Uri("https://www.educative.io/edpresso");// Get current objectConsole.WriteLine(uri1.GetType());Console.WriteLine(uri2.GetType());Console.WriteLine(uri3.GetType());Console.WriteLine(uri4.GetType());}}
In the above code:
Uri
.