This one little improvement in System.Xml 2.0 Beta2 is sooo cool anyway: XPathNodeIterator class at last implements IEnumerable! Such unification with .NET iteration model means we can finally iterate over nodes in an XPath selection using standard foreach statement:
XmlDocument doc = new XmlDocument(); doc.Load("orders.xml"); XPathNavigator nav = doc.CreateNavigator(); foreach (XPathNavigator node in nav.Select("/orders/order")) Console.WriteLine(node.Value);Compare this to what we have to write in .NET 1.X:
XmlDocument doc = new XmlDocument(); doc.Load("../../source.xml"); XPathNavigator nav = doc.CreateNavigator(); XPathNodeIterator ni = nav.Select("/orders/order"); while (ni.MoveNext()) Console.WriteLine(ni.Current.Value);Needless to say - that's the case when just a dozen lines of code can radically simplify a class's usage and improve overall developer's productivity. How come this wasn't done in .NET 1.1 I have no idea.
And how come the MSDN documentation for the class still doesn't mention this cool feature - I have no idea either.