Language Integrated
Query(LINQ) is a set of operators which allow traversal,projection
operations,filter in Visual Basic Programming language. It works in
three steps
: Obtain the source of data, Create the query and Query execution.
At the time of
execution data
is created by this query not retrieved.
By this simple
example I am
try to explain how a query works in this example. This query retrieves
those
numbers which is greater than 5.
Module
Module1
Sub Main()
Dim numbers As
Integer() = New
Integer(9) {0, 1, 2, 3, 4, 5, 6, 8, 9,
10}
Dim numQuery As
IEnumerable(Of
Integer) = From
num In numbers
Where (num Mod
2) = 0
Select num
For Each
j
As Integer
In numQuery
Console.Write("{0,1}
", j)
Next
Console.ReadLine()
End Sub
End
Module
OUTPUT:
