|
By Greg DeMichillie [bio]
Posted: Jun. 25, 2007
The following is an illustration accompanying an article published by Directions on Microsoft, an independent research firm focused exclusively on Microsoft strategy & technology. More samples of our content, as well as a list of upcoming articles and
reports are also available.

This screen shot shows how LINQ and Visual Studio 2008 make it easier for a developer to access data. A sample query that retrieves the name, category, and price of any product with a price greater than 20, sorted by category, is represented with and without LINQ.
At the top is the typical way a query is represented in code without using LINQ. The query itself is contained in quotation marks and neither the compiler nor the integrated development environment (IDE) is able to do any error checking on the contents of the query.
Below is the same query using LINQ. In this case, the IDE applies syntax coloring, which makes certain keywords (such as "from" and "where") appear in a different color. It can also check for common errors. For example, the column "ProductName" is misspelled (with a repeated 'a') and the IDE has detected that error and identified it with a squiggly underline. Finally, the IDE offers statement completion, as seen in the pop-up window. In this case, it is allowing the developer to select from a list of columns in the database rather than having to remember the names of all the columns.
|