Search code examples
silverlightlinq-to-xmlxmlreader

LINQ to XML vs. XmlReader


In my Silverlight application I'm using mostly XmlReader but I'm playing with idea to replace XmlReader implementation with LINQ to XML.

What are pros and cons between LINQ to XML and XmlReader in Silverlight?


Solution

  • PROs of Linq to XML

    • Query XML documents with the same LINQ syntax your used to
    • Uses the same X objects that you're used to working with (XElement, etc.)

    PROs of using XmlReader

    • Finer grain control over the query syntax (XPath rather than LINQ)

    ...personally, I switched to LINQ to XML when it was first introduced and never looked back. Haven't noticed any significant performance degradation as of yet.