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?
I would just use LINQ to XML in Silverlight.
The one advantage that XmlReader has over LINQ is that it doesn't build a DOM in memory but rather moves over an existing stream. However this difference only really comes into its own if you can start processing the stream as its arriving rather than waiting for the entire content to arrive. This advantage is quite difficult to acheive and only rarely useful.
LINQ to XML is much more straight forward to query and considerably more flexiable to use, the trade off is some extra memory.
...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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With