Finding element in XDocument?

前端 未结 7 1605
眼角桃花
眼角桃花 2020-12-02 20:02

I have a simple XML


  
    greatest Band
            


        
相关标签:
7条回答
  • 2020-12-02 20:38

    The Elements() method returns an IEnumerable<XElement> containing all child elements of the current node. For an XDocument, that collection only contains the Root element. Therefore the following is required:

    var query = from c in xmlFile.Root.Elements("Band")
                select c;
    
    0 讨论(0)
提交回复
热议问题