Extensions Class

 

Contains the LINQ to XML extension methods.

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

System.Object
  System.Xml.Linq.Extensions

public static class Extensions

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAncestors<T>(IEnumerable<T>)

Returns a collection of elements that contains the ancestors of every node in the source collection.

System_CAPS_pubmethodSystem_CAPS_staticAncestors<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the ancestors of every node in the source collection. Only elements that have a matching XName are included in the collection.

System_CAPS_pubmethodSystem_CAPS_staticAncestorsAndSelf(IEnumerable<XElement>)

Returns a collection of elements that contains every element in the source collection, and the ancestors of every element in the source collection.

System_CAPS_pubmethodSystem_CAPS_staticAncestorsAndSelf(IEnumerable<XElement>, XName)

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

System_CAPS_pubmethodSystem_CAPS_staticAttributes(IEnumerable<XElement>)

Returns a collection of the attributes of every element in the source collection.

System_CAPS_pubmethodSystem_CAPS_staticAttributes(IEnumerable<XElement>, XName)

Returns a filtered collection of the attributes of every element in the source collection. Only elements that have a matching XName are included in the collection.

System_CAPS_pubmethodSystem_CAPS_staticDescendantNodes<T>(IEnumerable<T>)

Returns a collection of the descendant nodes of every document and element in the source collection.

System_CAPS_pubmethodSystem_CAPS_staticDescendantNodesAndSelf(IEnumerable<XElement>)

Returns a collection of nodes that contains every element in the source collection, and the descendant nodes of every element in the source collection.

System_CAPS_pubmethodSystem_CAPS_staticDescendants<T>(IEnumerable<T>)

Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

System_CAPS_pubmethodSystem_CAPS_staticDescendants<T>(IEnumerable<T>, XName)

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

System_CAPS_pubmethodSystem_CAPS_staticDescendantsAndSelf(IEnumerable<XElement>)

Returns a collection of elements that contains every element in the source collection, and the descendent elements of every element in the source collection.

System_CAPS_pubmethodSystem_CAPS_staticDescendantsAndSelf(IEnumerable<XElement>, XName)

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.

System_CAPS_pubmethodSystem_CAPS_staticElements<T>(IEnumerable<T>)

Returns a collection of the child elements of every element and document in the source collection.

System_CAPS_pubmethodSystem_CAPS_staticElements<T>(IEnumerable<T>, XName)

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

System_CAPS_pubmethodSystem_CAPS_staticInDocumentOrder<T>(IEnumerable<T>)

Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

System_CAPS_pubmethodSystem_CAPS_staticNodes<T>(IEnumerable<T>)

Returns a collection of the child nodes of every document and element in the source collection.

System_CAPS_pubmethodSystem_CAPS_staticRemove(IEnumerable<XAttribute>)

Removes every attribute in the source collection from its parent element.

System_CAPS_pubmethodSystem_CAPS_staticRemove<T>(IEnumerable<T>)

Removes every node in the source collection from its parent node.

Most of the LINQ to XML extension methods are axis methods that are used in LINQ queries. The methods in this class operate on collections and return collections. These methods enumerate the source collection, call the appropriate axis method on each item in the collection, and concatenate the results.

The two Remove extension methods are not axis methods, however. These methods remove attributes or nodes from the XML tree.

Note that there is another category of axis methods, implemented in the XElement, XDocument, and XNode classes. These other axis methods operate on a single object, and return a collection of XElement, XAttribute, or XNode objects.

All of the axis extension methods use 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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: