O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Anatomy of a LINQ Query

LINQ queries always start with this syntax:[29]

From rangeVariable In DataList

Frankly, from a programmer’s point of view, we didn’t understand at first why queries had to start with From. What is actually taken or used from the range variable?

The Visual Basic team has the following answer:

“‘From’ indicates source or origin. The ‘From’ clause is where you specify the query source (i.e. a data context, in-memory collection, xml, etc.). Thus, we felt the term was appropriate. ‘FROM’ is also a keyword in SQL. We tried to maintain as much continuity as possible from SQL to LINQ, so that newcomers to LINQ who had experience with SQL would sense the familiarity.

One interesting difference from SQL we had to make is the ordering ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required