We are storing config files as XML. With that being said, when reading the XML file, is it better to use LINQ to query the XML file or would using the XMLDocument
and/or XMLNode
classes better to use?
To me, it would seem that in this instance, LINQ is not necessary. But then I tried to think of any value of one over the other down the road if the structure of the XML were to change.
So my question is, is one method of reading XML better or more accepted way of doing it over the other?
LINQ, through XDocument
is the recommended way to parse/read/query data in XML on the .NET platform.
There are many benefits including built in support for namespaces and implicit string conversions when building up a query.
1