Export (0) Print
Expand All

How to: Access XML Attributes (Visual Basic)

This example shows how to use an attribute axis property to access XML attributes in an XML element by name. In particular, it uses the type attribute axis property to access the attribute named type in the phone object.

Dim phone As XElement = <phone type="home">206-555-0144</phone>

Console.WriteLine("Type: " & phone.@type)
Show:
© 2015 Microsoft