DescendantsAndSelf

The DescendantsAndSelf operator can be called on a sequence of elements and returns a sequence containing each source element and its descendant elements.

Prototypes

The DescendantsAndSelf operator has two prototypes.

Example. The First DescendantsAndSelf Prototype
public static IEnumerable<XElement> DescendantsAndSelf (
  this IEnumerable<XElement> source
)

This version is called on a sequence of elements and returns a sequence of elements containing each source element and its descendant elements.

Example. The Second DescendantsAndSelf Prototype
public static IEnumerable<XElement> DescendantsAndSelf (
  this IEnumerable<XElement> source,
  XName name
)

This version is like the first, except only those elements matching the ...

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.