How LINQ expression is composed in VB.NET

LINQ expressions have a superficial similarity to SQL queries, but the order of the clauses is rearranged.

All LINQ expressions must have a from clause that indicates the data source and a select clause that

indicates the data Web developer wants to retrieve (or a group clause that defines a series of groups into which the data should be placed). The from clause is placed first:


Dim matches = From client In clients


The from clause identifies two pieces of information:

-The word immediately after in identifies the data source—in this case, it’s the collection object named clients that holds the Client details instances.

– The word immediately after from assigns an alias that represents individual items in the data source.


The next simplest possible LINQ query, retrieves the full set of data from the clients collection:


Dim matches = From client In clients

Select client