.NET Framework Class Library  

Uri.GetLeftPart Method

Returns the specified portion of a URI.

[Visual Basic]
Public Function GetLeftPart( _
   ByVal part As UriPartial _
) As String
[C#]
public string GetLeftPart(
   UriPartial part
);
[C++]
public: String* GetLeftPart(
   UriPartial part
);
[JScript]
public function GetLeftPart(
   part : UriPartial
) : String;

Parameters

part
One of the UriPartial values that specifies the the end of the portion of the URI to return.

Return Value

A string containing the specified portion of the URI.

Remarks

The GetLeftPart method returns a string containing the left-most portion of the URI, ending with the portion specified by part. The string returned includes delimiters but does not include any fragments or queries or their delimiters, except in certain cases.

GetLeftPart includes delimiters in the following cases:

The following examples show a URI and the results of calling GetLeftPart with Scheme, Authority, or Path.

URI Scheme Authority Path
http://www.contoso.com/index.htm#main http:// http://www.contoso.com http://www.contoso.com/
mailto:user@contoso.com?subject=uri mailto:   mailto:user@contoso.com
nntp://news.contoso.com/123456@contoso.com nntp:// nntp://news.contoso.com nntp://news.contoso.com/123456@contoso.com
news:123456@contoso.com news:   news:123456@contoso.com
file://server/filename.ext file:// file://server file://server/filename.ext
file:/filename.ext file:   file:/filename.ext

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

See Also

Uri Class | Uri Members | System Namespace