So i have this code:
foreach (string xmlfilelisted in xmlFileList)
{
resultXml.Root.Add(XDocument.Load(xmlfilelisted).Root.Elements());
resultXml.Save(filepath);
}
This is basically to merge a large number of same format xml files. Now this processes about 1300 files in a minute and half. I want to process, say 200k files. How do i go about that? Clearly the above code wont be practical to do it.
Any links or snippets would be appreciated. Thanks guys!
Try moving your
Save()method call outside the loop. You just have to worried about exceptions throwing away all of the results so maybe you can put theSave()inside of afinallyblock.