共用方式為


XML Data

Microsoft Silverlight will reach end of support after October 2021. Learn more.

You can parse XML data in Silverlight by using either LINQ to XML or XmlReader.

This section provides an overview of the two technologies, and examples that process XML data by using both technologies. This section also includes links to the .NET Framework documentation for more information.

Parsing with XmlReader vs. LINQ to XML

XmlReader is a fast, forward-only, non-caching parser. LINQ to XML is implemented on top of XmlReader, and they are tightly integrated.

In general, you should use XmlReader to read very large documents, because loading such documents into an in-memory tree uses a lot of memory and decreases performance.

If you are building a system that parses smaller XML documents, you can take advantage of the productivity improvements that LINQ to XML provides.

In This Section