語言

SecurityElement.SearchForChildByTag(String) 方法

定義

透過標籤名稱找到一個孩子。

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

參數

tag
String

在子元素中搜尋的標籤。

傳回

第一個具有指定標籤值的子 XML 元素,或null若不存在子元素 。tag

例外狀況

參數 tag 為 null。

範例

以下程式碼展示了如何利用 SearchForChildByTag 該方法透過標籤名稱尋找子節點。 此程式碼範例是本類別更大範例 SecurityElement 的一部分。

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

備註

以下 XML SearchForChildByTag("second") 將回傳子元素 <second>。

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

適用於