C# Uri Segments
Description
Uri Segments
gets an array containing the path segments
that make up the specified URI.
Syntax
Uri.Segments
has the following syntax.
public string[] Segments { get; }
Example
The following example creates a Uri instance with 3 segments and displays the segments on the screen.
//from ww w . j av a2 s .c o m
using System;
public class MainClass{
public static void Main(String[] argv){
Uri uriAddress1 = new Uri("http://www.java2s.com/title/index.htm");
Console.WriteLine("The parts are {0}, {1}, {2}",
uriAddress1.Segments[0],
uriAddress1.Segments[1],
uriAddress1.Segments[2]);
}
}
The code above generates the following result.