Intro to LINQ to XML
LINQ, which stands for "Language-Integrated Query," is a programming interface developed by Microsoft and designed for querying and modifying data. The LINQ syntax is useful in the CMS environment because it's supported by C# and because it can be used to query XML. Also, Visual Studio recognizes LINQ syntax and will apply IntelliSense to LINQ expressions.
The syntax for running a LINQ query against XML data is called, fittingly, LINQ to XML. LINQ to XML can be used in place of XPath and XQuery expressions, and it replaces the old DOM (Document Object Model) with simpler conventions for working with XML.
It is beyond the scope of this course to provide a full overview of LINQ to XML syntax. However, there are a few classes and methods that it's helpful to recognize.
Many of the LINQ to XML classes that you'll see referenced in C# resemble concepts from the XML DOM. Here are a few classes that you might encounter:
XElement
XAttribute
XComment
XNode
XDocumentType
And here are a few common LINQ to XML methods:
Add()
Remove()
Replace()
Set()
Related Topics