I am trying to do a simple count of some descendants using LINQ to XML and the "Count()" method does not exist for me?
Example:
using System.Xml.Linq;
XDocument doc = XDocument.Load( "somexmlfile" );
int count = doc.Descendants("somethinghere").Count();
The above won't compile, because it doesn't recognize the Count()
method.
Do you have using System.Linq;
at the top of the file?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With