Programming Guide (LINQ to XML)

This section provides conceptual and how-to information about programming with LINQ to XML. 

Who Should Read This Documentation

This documentation targets developers who already understand C# and some basic aspects of the .NET Framework.

The goal of this documentation is to make LINQ to XML easy to use for all kinds of developers. LINQ to XML makes XML programming easier. You do not have to be an expert developer to use it.

LINQ to XML relies heavily on generic classes. Therefore, is very important that you understand the use of generic classes. Further, it is helpful if you are familiar with delegates that are declared as parameterized types. If you are not familiar with C# generic classes, see Generic Classes (C# Programming Guide).

In This Section



LINQ to XML Programming Overview

Provides an overview of the LINQ to XML classes, and detailed information about three of the most important classes: XElement, XAttribute, and XDocument.

Creating XML Trees

Provides conceptual and task-based information about creating XML trees. You can create XML trees by using functional construction, or by parsing XML text from a string or a file. You can also use an XmlReader to populate an XML tree. Creating an XML tree in Visual Basic is very different from creating one in C#. These topics describe how to create XML trees in both languages.

Working with XML Namespaces

Provides detailed information about creating XML trees that use namespaces.

Serializing XML Trees

Describes multiple approaches to serializing an XML tree, and gives guidance on which approach to use.

LINQ to XML Axes

Enumerates and describes the LINQ to XML axis methods, which you must understand before you can write LINQ to XML queries.

Querying XML Trees

Provides common examples of querying XML trees.

Modifying XML Trees (LINQ to XML)

Like the Document Object Model (DOM), LINQ to XML enables you to modify an XML tree in place.

Advanced LINQ to XML Programming

Provides information about annotations, events, streaming, and other advanced scenarios.

LINQ to XML Security

Describes security issues associated with LINQ to XML and provides some guidance for mitigating security exposure.

Sample XML Documents (LINQ to XML)

Contains the sample XML documents that are used by many examples in this documentation.

See Also

Other Resources

Getting Started (LINQ to XML)