Thursday, 15 August 2013

Loop through different elements?

Loop through different elements?

I have some XML as such:
<Step>
<Check>...</Check>
<Check>...</Check>
<Action>...</Action>
</Step>
I want to loop through the sub nodes of <Step>. I know this line:
foreach (XElement substep in document.Descendants("Check"))
Loops through the elements only, how can I loop through the <Check>
elements and the <Action> elements?

No comments:

Post a Comment