Mega Code Archive

 
Categories / VB.Net / LINQ
 

Get the count of all employees hired this year

Imports System Imports System.Xml.Linq     Public Class MainClass         Public Shared Sub Main()             Dim employees As XElement = XElement.Load("Employees.xml")             Dim cnt = Aggregate ele In employees.<Employee> _                       Where CDate(ele.<HireDate>.Value).Year = Now.Year _                       Into Count()             Console.WriteLine("{0} employees were hired this year.", cnt)                      End Sub     End Class