Descendants

The Descendants operator can be called on a sequence of elements or documents and returns a sequence of elements containing each source element's or document's descendant elements.

Prototypes

The Descendants operator has two prototypes.

Example. The First Descendants Prototype
public static IEnumerable<XElement> Descendants<T> (
  this IEnumerable<T> source
) where T : XContainer

This version is called on a sequence of elements or documents and returns a sequence of elements containing each source element's or document's descendant elements.

This is different from the XContainer.Descendants method in that this method is called on a sequence of elements or documents, as opposed to a single element or document.

Example. The Second ...

Get Pro LINQ: Language Integrated Query in C# 2008 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.