Extensions.DescendantsAndSelf Method (IEnumerable<XElement>, XName)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns a filtered collection of elements that contains every element in the source collection, and the descendents of every element in the source collection. Only elements that have a matching XName are included in the collection.

Namespace:   System.Xml.Linq
Assembly:  System.Xml.Linq (in System.Xml.Linq.dll)

static member DescendantsAndSelf : 
        source:IEnumerable<XElement> *
        name:XName -> IEnumerable<XElement>

Parameters

source
Type: System.Collections.Generic.IEnumerable<XElement>

An IEnumerable<'T> of XElement that contains the source collection.

name
Type: System.Xml.Linq.XName

The XName to match.

Return Value

Type: System.Collections.Generic.IEnumerable<XElement>

An IEnumerable<'T> of XElement that contains every element in the source collection, and the descendents of every element in the source collection. Only elements that have a matching XName are included in the collection.

Although Visual Basic has an integrated XML axis for descendant elements, there is no integrated axis that has the semantics of this method, so Visual Basic users must use this axis method explicitly.

This method uses deferred execution.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: