다음을 통해 공유


Uri.GetLeftPart 메서드

Uri 인스턴스의 지정된 부분을 반환합니다.

네임스페이스: System
어셈블리: System(system.dll)

구문

‘선언
Public Function GetLeftPart ( _
    part As UriPartial _
) As String
‘사용 방법
Dim instance As Uri
Dim part As UriPartial
Dim returnValue As String

returnValue = instance.GetLeftPart(part)
public string GetLeftPart (
    UriPartial part
)
public:
String^ GetLeftPart (
    UriPartial part
)
public String GetLeftPart (
    UriPartial part
)
public function GetLeftPart (
    part : UriPartial
) : String

매개 변수

  • part
    반환할 URI 부분의 끝을 지정하는 UriPartial 값 중 하나입니다.

반환 값

Uri 인스턴스의 지정된 부분이 포함된 String입니다.

예외

예외 형식 조건

InvalidOperationException

현재 Uri 인스턴스가 절대 인스턴스가 아닌 경우

ArgumentException

지정된 part가 잘못된 경우

설명

GetLeftPart 메서드는 URI 문자열의 가장 왼쪽 부분을 포함하며 part에서 지정하는 부분으로 끝나는 문자열을 반환합니다.

다음과 같은 경우에는 GetLeftPart에 구분 기호가 포함됩니다.

  • Scheme에는 체계 구분 기호가 포함됩니다.

  • Authority에는 경로 구분 기호가 포함되지 않습니다.

  • Path는 원래 URI에 구분 기호를 포함합니다. 쿼리 또는 단편 구분 기호도 포함됩니다.

  • Query에는 Path와 쿼리 및 쿼리 구분 기호가 포함됩니다.

다음 예제에서는 Scheme, Authority, Path 또는 Query를 사용하여 GetLeftPart를 호출한 결과와 URI를 보여 줍니다.

URI

체계

권한

경로

쿼리

https://www.contoso.com/index.htm?date=today

http://

https://www.contoso.com

https://www.contoso.com/index.htm#main

https://www.contoso.com/index.htm?date=today

https://www.contoso.com/index.htm#main

http://

https://www.contoso.com

https://www.contoso.com/index.htm#main

https://www.contoso.com/index.htm#main

mailto:user@contoso.com?subject=uri

mailto:

mailto:user@contoso.com

mailto:user@contoso.com?subject=uri

<none>

nntp://news.contoso.com/123456@contoso.com

nntp://

nntp://news.contoso.com

nntp://news.contoso.com/123456@contoso.com

nntp://news.contoso.com/123456@contoso.com

news:123456@contoso.com

news:

news:123456@contoso.com

news:123456@contoso.com

<none>

file://server/filename.ext

file://

file://server

file://server/filename.ext

file://server/filename.ext

예제

다음 예제에서는 Uri 인스턴스를 만들고 경로를 콘솔에 씁니다.

' Create Uri
Dim uriAddress As New Uri("https://www.contoso.com/index.htm#search")
Console.WriteLine(uriAddress.Fragment)
Console.WriteLine("Uri {0} the default port ", IIf(uriAddress.IsDefaultPort, "uses", "does not use")) 'TODO: For performance reasons this should be changed to nested IF statements

Console.WriteLine("The path of this Uri is {0}", uriAddress.GetLeftPart(UriPartial.Path))
Console.WriteLine("Hash code {0}", uriAddress.GetHashCode())
// Create Uri
Uri uriAddress = new Uri("https://www.contoso.com/index.htm#search");
Console.WriteLine(uriAddress.Fragment);
Console.WriteLine("Uri {0} the default port ", uriAddress.IsDefaultPort ? "uses" : "does not use");
 
Console.WriteLine("The path of this Uri is {0}", uriAddress.GetLeftPart(UriPartial.Path));
Console.WriteLine("Hash code {0}", uriAddress.GetHashCode());

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

Uri 클래스
Uri 멤버
System 네임스페이스