Chapter 29


As stated in Chapter 27, “LINQ to SQL,” probably the biggest and most exciting addition to the .NET Framework 3.5 is the addition of the .NET Language Integrated Query framework (LINQ) into C# 2008. LINQ comes in many flavors depending on the final data store that you are working with in querying your data. Chapter 27 took a look at using LINQ to SQL to query SQL Server databases; this chapter takes a quick look at using LINQ to query your XML data sources instead.

You read about the following in this chapter:

  • What LINQ to XML brings to the table
  • The new objects available in the System.Xml.Linq namespace
  • How to query your XML documents using LINQ
  • Moving around your XML documents using LINQ
  • Using LINQ to SQL and LINQ to XML together

Extensible Markup Language (XML) is now in widespread use. Many applications on the Internet or residing on individual computers use some form of XML to run or manage the processes of an application. Earlier books about XML commented that XML was to be the “next big thing.” Now, it is “the big thing.” In fact, there really isn’t anything bigger.

Microsoft has been working for years to make using XML in the .NET world as easy as possible. You can’t help but notice the additional capability and the enhancements to XML usage introduced in each new version of the .NET Framework. In fact, Bill Gates highlighted Microsoft’s faith in XML in his keynote address at the Microsoft Professional Developers Conference in 2005 in Los Angeles. ...

Get Professional C# 2008 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.