Hi,
say I have an xml file with an X number of nodes I want to loop through (to,
for example, display each node as a HyperLink in an asp.net webpage). Which
of both is best practice:
1. Loop through a NodeList (e.g.: foreach XmlNode in XmlNodeList ... )
2. or use an XPathNodeIterator
Are there any differences in performance? Are both used for different
situations?
Thanks,
Vincent
Oleg Tkachenko - 08 Oct 2003 16:27 GMT
> say I have an xml file with an X number of nodes I want to loop through (to,
> for example, display each node as a HyperLink in an asp.net webpage). Which
> of both is best practice:
>
> 1. Loop through a NodeList (e.g.: foreach XmlNode in XmlNodeList ... )
> 2. or use an XPathNodeIterator
I assume you get XmlNodeList via SelectNodes() method. Then both approaches
are equivalent, becuase SelectNodes() is just a wrapper around
XPathNodeIterator, which provides list-like functionality.

Signature
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel