我的代码读取XML元素是这样的:vb.net XML For循环
Dim xmlRoot As XElement = XDocument.Load("x:\books.xml").Root
For Each book As XElement In xmlRoot.<book>
Debug.WriteLine(book.<title>.Value)
Debug.WriteLine(book.<author>.Value)
Debug.WriteLine(book.<year>.Value)
Debug.WriteLine(book.<price>.Value)
Next
我现在想的是,如何只显示10个元素。现在我已经显示了所有的xml元素,但我只需要前10个。 尝试了几个For循环组合,但没有得到它的工作。
感谢
你试过什么样的组合? – 2014-11-23 00:02:48