chp33 LINQ query Xml Document
pg 948-949
The following code in the book i'm get this error
Error 1 Could not find an implementation of the query pattern for source type 'System.Collections.Generic.IEnumerable<System.Xml .Linq.XElement>'. 'Select' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?
XDocument xdoc = XDocument.Load(@"C:\hamlet.xml"); /// put hamlet.xml in the correct path
////// ///
////////xdoc.Save(@"C:\CopyofHamlet.xml");
var query = from people in xdoc.Descendants("PERSONAE")
select people.Value;
Console.WriteLine("{0} Players Found", query.Count());
Console.WriteLine();
foreach (var item in query)
{
Console.WriteLine(item);
}
|