The first part of the query is retrieving the files in the given directory. The second part is a select projection that takes a given filename, loads an XDocument and retrieves all descendants of that document of a particular name. In terms of the delegate signature for the inner function, it would be
Func> func
As in a function that takes a string (file) and returns an IEnumerable of XElements.
Next, you're including what is currently an unnecessary Select call that simply takes an IEnumerable and returns the same IEnumerable.
Func, IEnumerable> func
And, lastly, you're retrieving the count of all elements in the IEnumerable>. But what you're getting is actually a count of the inner IEnumerable elements, not the count of the XElements.
To get the total count of your descendants, you could rewrite the statement to look something like this:
int sum = Directory.GetFiles(directoryPath)
.Select(file => XDocument.Load(file).Descendants(descendantName).Count())
.Sum();
Edit: Since I spelled out the other select functions, this one is taking a sting filename and returning an integer representing the count of descendants of a given name in the file.Func
And then, of course, you simply sum those integer results.