Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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