2

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?

6

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.

| improve this answer | |
  • Loading objects via LINQ to XML is a big benefit to me. – jfrankcarr Oct 18 '12 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.