Extensions::InDocumentOrder<T> Method (IEnumerable<T>^)

 

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

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

public:
generic<typename T>
where T : XNode
[ExtensionAttribute]
static IEnumerable<T>^ InDocumentOrder(
	IEnumerable<T>^ source
)

Parameters

source
Type: System.Collections.Generic::IEnumerable<T>^

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

Return Value

Type: System.Collections.Generic::IEnumerable<T>^

An IEnumerable<T> of XNode that contains all nodes in the source collection, sorted in document order.

Type Parameters

T

The type of the objects in source, constrained to XNode.

This axis method uses deferred execution. However, it first enumerates its source collection, the sorts the nodes in document order, and then yields the results.

The following example creates a collection of nodes that are not in document order, and then uses this axis to create a new collection where the nodes are in document order.

No code example is currently available or this language may not be supported.

This example produces the following output:

<aaa>1</aaa>
<ccc>3</ccc>
<ddd>5</ddd>

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: