开发者

Linq to Xml Get last Element - .Net 3.5

I'm trying to fetch the last element according to it's name.

I know there is Last() method on .Net 4, but since I must work with .Net 3.5 how can I find it.

Example: The xml used as log file. My method signatur开发者_开发知识库e: GetLast(XName xName), and returns the last element specified (ExecutionReport, Scenario, Function etc.) I would like to get this element in order to add element afterwards.

This is the Xml file:

Linq to Xml Get last Element - .Net 3.5


.Last() exists in .Net 3.5 too.

You can write parent.Elements("ChildName").Last().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜