Reading Node Count in Xml using LINQ to XML

I came upon this situation where I wanted to know the count of a certain node in an XML file. Now the count of that node could be way more than 50k so there was no way it could have been counted manually.

Therefore, I used LINQ to XML to get the count of the node.
 
The code for the same is as below: 
  1. string filename = @"C:\Vipul\Desktop\test.xml";  
  2.             var count = XDocument.Load(filename).Root.Descendants("ThisNode").Count();  
  3.             Console.WriteLine(count);  
This count of the node "ThisNode" is now in the variable count and can be used as required.
 
In case of any queries, please feel free to comment.