I am trying to parse some simple XML like this:
XElement thisLevel = from l in xmlElements.Descendants("Level")
where l.Element("LevelNum") == thisLevel
select l;
But I get an error on "levels" saying:
Could not find an implementation of the query pattern for source type 'System.Collections.Generic.IEnumerable'. 'Where' not found. Are you missing a reference or a using directive for 'System.Linq'?
Strangely I can grab descendents:
var levels = xmlElements.Descendants("Level");
That works, but I can't seem to where on it.
As ChrisF mentioned, these using statements are both required:
using System.Xml.Linq;
using System.Linq; // this one was missing
I had thought System.Xml.Linq would cover all everything linq-related.
Thanks, ChrisF!