I have a specific html node and i want to get the 2nd aka last direct descendant. So after writing .Descendants("div") i wrote ls.Last(). I actually got the last div in the 2nd descendant. Not what i am expecting. How do i get only the direct descendants? or how do i get the descendant with a specific classname? because “div.postBody” would be a suitable alternative.
I have a specific html node and i want to get the 2nd aka
Share
Using XPath would give you what you want. So for direct descendants only you can use –
Or if you need to search by specific classname then –