System Net C# by API

using System; 
using System.Net; 
 
public class UriDemo {  
  public static void Main() { 
 
    Uri sample = new Uri("http://MySite.com/somefile.txt?SomeQuery"); 
 
    Console.WriteLine("Host: " + sample.Host); 
    Console.WriteLine("Port: " + sample.Port); 
    Console.WriteLine("Scheme: " + sample.Scheme); 
    Console.WriteLine("Local Path: " + sample.LocalPath); 
    Console.WriteLine("Query: " + sample.Query); 
    Console.WriteLine("Path and queury: " + sample.PathAndQuery); 
 
  } 
}