SecurityElement.Attribute(String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在 XML 元素中按名称查找属性。
public:
System::String ^ Attribute(System::String ^ name);
public string Attribute(string name);
member this.Attribute : string -> string
Public Function Attribute (name As String) As String
参数
- name
- String
要搜索的属性的名称。
返回
与命名属性关联的值,或者 null 不存在任何 name 属性。
例外
参数 name 为 null.
示例
以下代码演示如何使用 Attribute 该方法按名称查找属性。 该代码示例是 SecurityElement 类中的一个较大示例的一部分。
string xmlCreationDate = xmlElement.Attribute("creationdate");
Dim xmlCreationDate As String = xmlElement.Attribute("creationdate")
注解
使用如下所示的 XML 将 Attribute("B") 返回“456”。
<thetag A="123" B="456" C="789">text</thetag>