Chapter 29. LINQ to XML

LINQ to XML lets you apply the LINQ query style that we saw in Chapter 27 to XML data. This is done through a set of classes that represent XML data in a way that is designed to accommodate LINQ to Objects queries. These classes are in the System.Xml.Linq namespace, and they make it easy to work with XML. Once you understand how these classes work and relate to one another, you can use LINQ queries to create powerful and simple XML handlers.

The LINQ to XML classes read all the XML data into memory. This is similar to the Document Object Model (DOM) approach, which you may have used in other programming languages. C# does provide support for DOM, but it has been eclipsed by the more flexible and expressive LINQ to XML features. ...

Get Introducing Visual C# 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.