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

Concatenating LINQ Queries and Delayed Execution

As mentioned earlier, LINQ query execution is always delayed. The title of this section could be misleading because it implies that you have a choice when using LINQ queries. But you don’t.

If you define a query, such as in the following example, and then run it, the query is not executed immediately:

Dim adrGroupedList = From adrItem In adrList Join productItem In prdList On adrItem.ID Equals productItem.IDPurchasedBy Select adrItem.ID, adrItem.LastName, adrItem.FirstName, adrItem.ZIP, productItem.ProductNo, productItem.ProductName, productItem.Amount, productItem.UnitPrice, ItemPrice = productItem.Amount * productItem.UnitPrice Order By LastName, ProductNo Where (ZIP > "0" And ZIP < "50000") Group ...

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