If you're processing a large amount of data (many megabytes) then you want to be using XmlReader
to stream parse the XML.
Anything else (XPathNavigator
, XElement
, XmlDocument
and even XmlSerializer
if you keep the full generated object graph) will result in high memory usage and also a very slow load time.
Of course, if you need all the data in memory anyway, then you may not have much choice.