Reputation: 4941
I've tried a bunch of queries using two xml files; one is the copy of the other. After removing a child of a child in one doc, I still get the same count when getting all elements. Can someone give an example of getting every single element in an xml file (siblings, children, etc) and returning the count? I just want to know how many elements are in the file. I don't need to filter or get values.
Upvotes: 0
Views: 86
Reputation: 125630
The simplest way:
var xDoc = XDocument.Load(yourDocumentPath);
var nbOfElements = xDoc.Descendants().Count();
Upvotes: 6