XElement.AncestorsAndSelf Method

Returns a collection of elements that contain this element, and the ancestors of this element.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method AncestorsAndSelf() Returns a collection of elements that contain this element, and the ancestors of this element.
Public method AncestorsAndSelf(XName) Returns a filtered collection of elements that contain this element, and the ancestors of this element. Only elements that have a matching XName are included in the collection.
Top

The elements in the returned collection are in reverse document order.

This method uses deferred execution.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft