| title | How to: Access XML Descendant Elements (Visual Basic) | ||||
|---|---|---|---|---|---|
| ms.custom | |||||
| ms.date | 07/20/2015 | ||||
| ms.prod | .net | ||||
| ms.reviewer | |||||
| ms.suite | |||||
| ms.technology |
|
||||
| ms.tgt_pltfrm | |||||
| ms.topic | article | ||||
| helpviewer_keywords |
|
||||
| ms.assetid | aabfa258-4112-4e7e-bab9-403f96072ef7 | ||||
| caps.latest.revision | 19 | ||||
| author | dotnet-bot | ||||
| ms.author | dotnetcontent |
This example shows how to use a descendant axis property to access all XML elements that have a specified name and that are contained under an XML element. In particular, it uses the Value property to get the value of the first element in the collection that the name descendant axis property returns. The name descendant axis property gets all elements named name that are contained in the contacts object. This example also uses the phone descendant axis property to access all descendants named phone that are contained in the contacts object.
[!code-vbVbXMLSamples#31]
This example requires:
- A reference to the xref:System.Xml.Linq namespace.
xref:System.Xml.Linq.XContainer.Descendants%2A?displayProperty=nameWithType
XML Descendant Axis Property
XML Value Property
Accessing XML in Visual Basic
XML