Uri.Fragment 속성

정의

이스케이프된 URI 조각을 가져옵니다.Gets the escaped URI fragment.

public:
 property System::String ^ Fragment { System::String ^ get(); };
public string Fragment { get; }
member this.Fragment : string
Public ReadOnly Property Fragment As String

속성 값

String

URI 조각 정보입니다.URI fragment information.

예외

이 인스턴스가 상대 URI를 나타내고 이 속성이 절대 URI에만 유효한 경우This instance represents a relative URI, and this property is valid only for absolute URIs.

예제

다음 예에서는 인스턴스를 만들고 해당 Uri 조각 정보를 콘솔에 씁니다.The following example creates a Uri instance and writes the fragment information to the console.

// Create Uri
Uri^ uriAddress = gcnew Uri( "http://www.contoso.com/index.htm#search" );
Console::WriteLine( uriAddress->Fragment );
Console::WriteLine( "Uri {0} the default port ", uriAddress->IsDefaultPort ? (String^)"uses" : "does not use" );

Console::WriteLine( "The path of this Uri is {0}", uriAddress->GetLeftPart( UriPartial::Path ) );
Console::WriteLine( "Hash code {0}", uriAddress->GetHashCode() );
// The example displays output similar to the following:
//        #search
//        Uri uses the default port
//        The path of this Uri is http://www.contoso.com/index.htm
//        Hash code -988419291
// Create Uri
Uri uriAddress = new Uri("http://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());
// The example displays output similar to the following:
//        #search
//        Uri uses the default port
//        The path of this Uri is http://www.contoso.com/index.htm
//        Hash code -988419291
' Create Uri
Dim uriAddress As New Uri("http://www.contoso.com/index.htm#search")
Console.WriteLine(uriAddress.Fragment)
Console.WriteLine("Uri {0} the default port ", If(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())
' The example displays output similar to the following:
'        #search
'        Uri uses the default port
'        The path of this Uri is http://www.contoso.com/index.htm
'        Hash code -988419291

설명

Fragment속성은 단편 마커 자체를 포함 하 여 URI의 조각 마커 (#) 뒤에 있는 모든 텍스트를 가져옵니다.The Fragment property gets any text following a fragment marker (#) in the URI, including the fragment marker itself. URI가 지정 된 경우 http://www.contoso.com/index.htm#main Fragment 속성은 #main 반환 합니다.Given the URI http://www.contoso.com/index.htm#main, the Fragment property would return #main.

Fragment속성은 비교 시 고려 되지 않습니다 Equals .The Fragment property is not considered in any Equals comparison.

적용 대상