Get Last Element in C# using XElement

前端 未结 5 936
一向
一向 2020-12-07 04:35

I have a XML feed loaded in an XElement.

The structure is





         


        
5条回答
  •  余生分开走
    2020-12-07 04:57

    You can use LastNode property on root element:

    XElement root = doc.Root;
    XElement lastPost = (XElement)root.LastNode;
    

提交回复
热议问题