Share via


HOW TO:存取 XML 屬性 (Visual Basic)

更新:2007 年 11 月

這個範例顯示如何使用屬性 (Attribute) 軸屬性 (Property),依名稱存取 XML 項目中的 XML 屬性 (Attribute)。具體而言,它會使用 type 屬性 (Attribute) 軸屬性 (Property) 來存取 phone 物件中名為 type 的屬性 (Attribute)。

範例

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

Console.WriteLine("Type: " & phone.@type)

請參閱

參考

XML 屬性軸屬性

XElement.Attributes

其他資源

在 Visual Basic 中存取 XML

Visual Basic 中的 XML