LINQ to XML Dynamic Properties

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at LINQ to XML Dynamic Properties.

This section provides reference information about the dynamic properties in LINQ to XML. Specifically, these properties are exposed by the XAttribute and XElement classes, which are in the System.Xml.Linq namespace.

As explained in the topic Overview of WPF Data Binding with LINQ to XML, each of the dynamic properties is equivalent to a standard public property or method in the same class. These standard members should be used for most purposes; dynamic properties are provided specifically for LINQ to XML data binding scenarios. For more information about the standard members of these classes, see the XAttribute and XElement reference topics.

With respect to their resolved values, the dynamic properties in this section fall into two categories:

  • Simple ones, such as the Value properties in the XAttribute and XElement classes, that resolve to a single value.

  • Indexed values, such as the Elements and Descendants properties of XElement, that resolve into an indexer type. For indexer types to be resolved to the desired value or collection, an expanded name parameter must be passed to them.

All the dynamic properties that return an indexed value of type IEnumerable<T> use deffered execution. For more information about deferred execution, see Introduction to LINQ Queries (C#).

TopicDescription
XAttribute Class Dynamic PropertiesProvides details about the dynamic properties exposed by the XAttribute class.
XElement Class Dynamic PropertiesProvides details about the dynamic properties exposed by the XElement class.

System.Xml.Linq

System.Xml.Linq.XElement

System.Xml.Linq.XAttribute

WPF Data Binding with LINQ to XML
WPF Data Binding with LINQ to XML Overview
Introduction to LINQ Queries (C#)

Show: