views:

14

answers:

1

Let's say I have nodes like so:

<Params>
 <Param val="C" />
 <Param val="D" />
 <Param val="A" />
 <Param val="B" />
<Params>

If I select the Descendants of Params is the order always preserved? I want C to always be first when I iterate through the ordered list that I'll be dropping these into. Or do I need to come up with a different solution for ordering nodes? I'd like to stay away from numbers (order="1", 2 etc.) so any suggestions would be great.

+1  A: 

The documentation for the Descendants property says:

Returns a collection of the descendant elements for this document or element, in document order.

So the answer is yes, they will be returned in the same order they appear in the original XML.

Aaronaught
Oops, I spose I coulda found that. Thanks tho.
jcollum