SecurityElement.SearchForTextOfTag(String) 메서드

정의

태그 이름으로 자식 항목을 찾고 포함된 텍스트를 반환합니다.

public:
 System::String ^ SearchForTextOfTag(System::String ^ tag);
public string? SearchForTextOfTag(string tag);
public string SearchForTextOfTag(string tag);
member this.SearchForTextOfTag : string -> string
Public Function SearchForTextOfTag (tag As String) As String

매개 변수

tag
String

자식 요소에서 검색할 태그입니다.

반품

지정된 태그 값이 있는 첫 번째 자식 요소의 텍스트 내용입니다.

예외

tagnull입니다.

예제

다음 코드에서는 메서드를 SearchForTextOfTag 사용하여 태그 이름으로 자식을 찾고 포함된 텍스트를 반환하는 방법을 보여 있습니다. 이 코드 예제는 클래스에 제공된 더 큰 예제의 SecurityElement 일부입니다.

string storedDestroyTime =
    localXmlElement.SearchForTextOfTag("destroytime");
Dim storedDestroyTime As String = localXmlElement.SearchForTextOfTag("destroytime")

설명

이 메서드는 다음과 같습니다.

string SearchForTextOfTag(string tag)
{
    SecurityElement element = this.SearchForChildByTag(tag);
    return element.Text;
}
Public Function SearchForTextOfTag(ByVal tag As String) As String
    Dim element As SecurityElement = MyClass.SearchForChildByTag(tag)
    Return element.Text
End Function

XML을 SearchForTextOfTag("second") 다음과 같이 사용하면 "text2"를 반환합니다.

<thetag A="123" B="456" C="789"> <first>text1</first>
    <second>text2</second></thetag>

적용 대상