C# Uri GetLeftPart
Description
Uri GetLeftPart
gets the specified portion of a Uri instance.
Syntax
Uri.GetLeftPart
has the following syntax.
public string GetLeftPart(
UriPartial part
)
Parameters
Uri.GetLeftPart
has the following parameters.
part
- One of the UriPartial values that specifies the end of the URI portion to return.
Returns
Uri.GetLeftPart
method returns A String that contains the specified portion of the Uri instance.
Example
The following example creates a Uri instance and writes the path to the console.
//from w ww. j a v a 2s. com
using System;
public class MainClass{
public static void Main(String[] argv){
// Create Uri
Uri uriAddress = new Uri("http://www.java2s.com/index.htm#search");
Console.WriteLine(uriAddress.GetLeftPart(UriPartial.Path));
}
}
The code above generates the following result.