I am now learning XmlDocument but I\'ve just ran into XDocument and when I try to search the difference or benefits of them I can\'t find something useful, could you please
XmlDocument
is great for developers who are familiar with the XML DOM object model. It's been around for a while, and more or less corresponds to a W3C standard. It supports manual navigation as well as XPath
node selection.
XDocument
powers the LINQ to XML feature in .NET 3.5. It makes heavy use of IEnumerable<>
and can be easier to work with in straight C#.
Both document models require you to load the entire document into memory (unlike XmlReader
for example).