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 signature: 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: 
.Last()exists in .Net 3.5 too.You can write
parent.Elements("ChildName").Last().