【问题标题】:GetNamedItem() vs. indexGetNamedItem() 与索引
【发布时间】:2014-09-02 10:35:41
【问题描述】:

GetNamedItem("test") 方法和 XmlAttributeCollection 中的索引访问有区别吗?也许在 null 处理或其他方面?

xml_node.Attributes.GetNamedItem("test").Value;
xml_node.Attributes["test"].Value;

【问题讨论】:

    标签: c# xml xml-attribute xmlattributecollection


    【解决方案1】:

    XmlAttributeCollection.ItemOf Property (String)

    此属性是 Microsoft 对文档对象模型 (DOM) 的扩展。它相当于调用GetNamedItem

    【讨论】:

    • 谢谢。我在 msdn 上找不到。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-07
    • 2010-09-15
    • 2011-10-13
    • 2014-09-09
    • 2015-10-10
    相关资源
    最近更新 更多