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 don't need all of the nodes in the XML file at same time.
I want to get them ten at a time.
I tried working with XPathSelectElements, but that gets all the nodes, and then I need to iterate through them.
So, is there a way to get the nodes from the XML file which are 40-50? I want to modify ReadTransactions
- to have another input parameter (40 in this case), and instead of all the elements, it will return just 10?
what about ElementAt
seems to me this is what you are looking for
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With