C# Uri Port
Description
Uri Port
gets the port number of this URI.
Syntax
Uri.Port
has the following syntax.
public int Port { get; }
Example
The following example writes the URI port number to the console. In this case, the value is the default port number for HTTP, port 80.
/*from www. j a v a2s . c o m*/
using System;
public class MainClass{
public static void Main(String[] argv){
Uri baseUri = new Uri("http://www.java2s.com/");
Uri myUri = new Uri(baseUri,"catalog/shownew.htm?date=today");
Console.WriteLine(myUri.Port);
}
}
The code above generates the following result.