Udostępnij przez


SecurityElement.SearchForChildByTag(String) Metoda

Definicja

Znajduje element podrzędny według jego nazwy tagu.

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

Parametry

tag
String

Tag, dla którego mają być wyszukiwane elementy podrzędne.

Zwraca

Pierwszy podrzędny element XML z określoną wartością tagu lub null jeśli element podrzędny tag nie istnieje.

Wyjątki

Parametr tag to null.

Przykłady

Poniższy kod przedstawia użycie metody w celu znalezienia elementu podrzędnego SearchForChildByTag według jego nazwy tagu. Ten przykład kodu jest częścią większego przykładu podanego SecurityElement dla klasy.

if ( localXmlElement->SearchForChildByTag( L"destroytime" ) != nullptr )
if (localXmlElement.SearchForChildByTag("destroytime") != null)
If Not (localXmlElement.SearchForChildByTag("destroytime") Is Nothing) Then

Uwagi

W przypadku kodu XML w następujący sposób SearchForChildByTag("second") zwraca element podrzędny <second>.

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

Dotyczy