SecurityElement.SearchForChildByTag(String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
按其标记名称查找子级。
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
要在其中搜索子元素的标记。
返回
具有指定标记值 null 或不存在子元素的第一个子 XML 元素 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>