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

C# in Depth, 3rd Edition

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:


var 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:


var matches = from client in clients

select client;