Query for all of the employees that make (HourlyRate) more than $100 an hour
Imports System
Imports System.Xml.Linq
Public Class MainClass
Public Shared Sub Main()
Dim employees As XElement = XElement.Load("Employees.xml")
Dim query = From ele In employees.<Employee> _
Where CDbl(ele.<HourlyRate>.Value) >= 100 _
Select ele.@id, ele.<Name>.Value, Pay = CDbl(ele.<HourlyRate>.Value) _
Order By Name
For Each emp In query
Console.WriteLine("[{0,-2}] {1,-25} ${2,-6}", emp.id, emp.Name, emp.Pay.ToString("##.00"))
Next
End Sub
End Class
Related examples in the same category