I have this method:
private IEnumerable<XElement> ReadTransactions(string file_name)
{
using (var reader = XmlReader.Create(file_name + ".xml"))
{
while (reader.ReadToFollowing("transaction", "urn:namepsaceUri"))
{
using (var subtree = reader.ReadSubtree())
{
yield return XElement.Load(subtree);
}
}
}
}
This method reads from an XML file. However, I do not need all the nodes in the XML file at the same time.
I want to get ten each at a time.
I tried to work with XPathSelectElements, but it gets all the nodes, and then I need to go through them.
So, is there a way to get nodes from an XML file that are 40-50? I want to change ReadTransactions- to have a different input parameter (40 in the ReadTransactionscase), and instead of all elements it will only return 10?
source
share