问题描述
我知道,我知道这已经做死;我只是张贴问题,看看这个解决方案仍然具有现实意义,因为现在我们有.NET 4和新
I know, I know this has been done to death; Im just posting a question to see if this solution is still relevant since now we have .NET 4 and newer
的解释一个简单的方法来读取大的XML文件和它实现Linq的。我很喜欢这一点,只想要一个简单的答案/ s的声明,如果这仍然是相关的还是有较新的.NET代码更好的实现。
This link explain a simple way to read large XML files and it implements Linq. I quite like this and just want a simple answer/s to state if this is still relevant or are there better implementations in newer .NET code.
推荐答案
在回答这个问题并没有在.NET 4改变 - 为了获得最佳性能,你仍然应该使用的因为它的流的文档,而不是装载全部的东西到内存中。
The answer to this question hasn't changed in .NET 4 - for best performance you should still be using XmlReader as it streams the document instead of loading the full thing into memory.
您参考使用代码的XmlReader
实际查询等等应该是对大型文档相当快。
The code you refer to uses XmlReader
for the actual querying so should be reasonably quick on large documents.
这篇关于C#和读取大型XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!