แก้ไข

แชร์ผ่าน


Process XML Data Using LINQ to XML

LINQ to XML is the new model in the .NET Framework version 3.5 for processing XML data. LINQ to XML allows developers to do everything they would expect with XML data: querying, modifying, creating, saving, and serializing XML documents. The real advantages lie in the query and creation capabilities.

Queries in LINQ to XML are succinct and expressive, using syntax more similar to SQL than to XPath or XQuery. Because query results can be returned as collections of elements or attributes and can be used as parameters for XElement objects, XML trees can be easily transformed from one shape to another.

LINQ to XML leverages the language-integrated query (LINQ) technology in .NET Framework version 3.5. LINQ extends the language syntax of C# and Visual Basic to provide powerful query capabilities that can be extended to potentially any data store.

For a detailed discussion of its use, see LINQ to XML (C#) and LINQ to XML (Visual Basic). For an overview of the LINQ framework, see Language-Integrated Query (LINQ) - C# or Language-Integrated Query (LINQ) - Visual Basic.

See also