Get Last Element in C# using XElement

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

I have a XML feed loaded in an XElement.

The structure is





         


        
5条回答
  •  遥遥无期
    2020-12-07 05:09

    Or try this to get XElement:

    XDocument doc = XDocument.Load("yourfile.xml");          
    XElement root = doc.Root;
    Console.WriteLine(root.Elements("post").Last());
    

提交回复
热议问题