Using For Each to loop through the result of Xml query
Imports System Imports System.Reflection Imports System.Xml Module Module1 Sub Main() Dim xml As XElement = XElement.Load("People.xml") Dim query = From s In xml.Elements("salary").Elements("id") _ Where s.Attribute("year").Value = 2004 _ Select s For Each record In query Console.WriteLine("Amount: {0}", record.Attribute("salaryyear")) Next End Sub End Module