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.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version