我在XElement中加载了XML Feed.
结构是
<root>
<post></post>
<post></post>
<post></post>
<post></post>
.
.
.
.
<post></post>
</root>
Run Code Online (Sandbox Code Playgroud)
我想直接获取Last帖子的值.我如何在C#中使用XElement.
谢谢.
或者尝试这个来获得XElement:
XDocument doc = XDocument.Load("yourfile.xml");
XElement root = doc.Root;
Console.WriteLine(root.Elements("post").Last());
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11245 次 |
| 最近记录: |