Children of XElement

前端 未结 3 1426
Happy的楠姐
Happy的楠姐 2020-12-29 02:11

How do I get just the children of an XElement?

I am currently using the XElement.Descendants() function, which returns all levels of XElements, rather than just the

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 02:28

    XElement.Nodes() should get you what you want.

    If you just want the XElement child nodes then you might need to restrict it (depending on your XML) with:

    XElement.Nodes().OfType()
    

提交回复
热议问题