Get the count of all employees hired this year. : Count « LINQ « VB.Net






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

   
    
    
    
  








Related examples in the same category

1.Get count from the query
2.Using Count to return a list of employeeList and how many orders each has
3.Using Count to return a list of categories and how many projectList each has
4.Aggregating Count with Conditional
5.Using Aggregating Count to get the number of unique factors of 300