Wrox Programmer Forums
BOOK: Professional C# 2008 ISBN: 978-0-470-19137-8
This is the forum to discuss the Wrox book Professional C# 2008 by Christian Nagel, Bill Evjen, Jay Glynn, Morgan Skinner, Karli Watson; ISBN: 9780470191378
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C# 2008 ISBN: 978-0-470-19137-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 4th, 2010, 02:28 AM
Registered User
Join Date: Feb 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 29. LINQ to XML compile error

The code snippet:

  XDocument xdoc = XDocument.Load(@"C:\hamlet.xml"); 

  var query = from people in xdoc.Descendants("PERSONA") select people.Value;

  Console.WriteLine("{0} Players Found", query.Count());

  foreach (var item in query)

fails to compile in Visual C# 2008 Express. The 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'? C:\Users\DaveTheCaver\Desktop\ProC#Book\ch29 CodeSample\Chapter 29\ConsoleApplication1\ConsoleApplication1\Program .cs 15 40 ConsoleApplication1

appears to be complaining about xdoc.Descendants("PERSONA"). The project has a reference to the System.Core.DLL and a using System.Linq directive.

Is there another reason for this error?

Last edited by DaveTheCaver; February 4th, 2010 at 02:30 AM..
Old March 4th, 2011, 07:54 AM
Authorized User
Join Date: Mar 2011
Posts: 17
Thanks: 3
Thanked 0 Times in 0 Posts

Hi Dave !

Firstly try including this namespace System.Xml.Linq

Secondly check whether the XName in the Descendant method exist in your XML file.

Have u included in ur code ?
Using System.Core.Dll
Using System.Linq

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 29, Listing 29-7, Page 1305 kiwibrit BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 September 11th, 2009 05:53 AM
Chapter 29, IIS Host slginps BOOK: Professional Visual Basic 2008 ISBN: 978-0-470-19136-1 2 April 25th, 2009 04:40 PM
Where is the sample code for Chapter 29 reddyjyoshna BOOK: Professional C# 2005 with .NET 3.0 ISBN: 978-0-470-12472-7 0 December 18th, 2008 08:14 AM
Ch 29 Deploying: Debug vs Release dvj81 BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 May 30th, 2006 09:50 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.