score:3

Accepted answer

You look for "td" elements but at the top level of the node you only find a "tr" element. That's why you don't get any elements. Try this:

from c in info.Elements("tr").Elements("td")

Also, you should check if there are any elements in the sequence before calling First() (or use FirstOrDefault() which returns null if there is no element).

If you don't know the path and only want all "td" elements with that tag value, you can also use the Descendants extension method:

from c in info.Descendants("td")

score:0

Elements would give you the immediate child elements of the root in this case info. You need to drill down to the elements you are looking for and then extract them by the Where clause. In your case the immediate children are the <tr>s.


Related Query

More Query from same tag