Chapter 13. LINQ to XML: Querying Nodes

Starting with the XML Infoset you learned about in Chapter 12, you can think of every node set as a sequence of nodes that you can query using Microsoft Language Integrated Query (LINQ)—just like any sequence of type IEnumerable<T>. From that perspective, you can make the case that every concept you have already seen applied to other sequences of items in the LINQ query fields (such as LINQ to Objects, LINQ to SQL, and so forth) can also be used with XML nodes. In fact, LINQ to XML exposes every collection of nodes as an IEnumerable<T> instance.

Querying XML

You can use the standard query extension methods described in Chapter 3, to query XML nodes, but there are also a group of custom extension methods, declared ...

Get Programming Microsoft® LINQ in Microsoft .NET Framework 4 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.