In general, downloading the file first and saving it will likely be slower than just using XDocument.Load(string)
. The Load
method which accepts a string will stream the contents directly into the XDocument
reader, which eliminates extra overhead in the save/read calls. Internally, the Load(string)
method creates a Stream
and downloads the file, reading from the Stream
directly.
However, if the XML document you're loading is static, and you're calling this multiple times, it could (potentially) make sense to cache it locally to avoid the network traffic.