VB.Net/LINQ/Count
Get count from the query
Module Program
Sub Main()
Dim currentVideoGames() As String = {"A", "B", "this is a test", "D", "E", "S"}
Dim numb As Integer = (From g In currentVideoGames _
Where g.Length > 6 _
Order By g _
Select g).Count()
Console.WriteLine("{0} items honor the LINQ query.", numb)
End Sub
End Module
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