LINQ in VB Device Projects – One last post

You Can Take it With You

Syndication

News

  • Don't miss the next Windows Mobile Webcast... Unit Testing for Mobile Devices: http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032382824&EventCategory=4&culture=en-US&CountryCode=US.

In Tuesday's post I described why the LINQ queries in VB Smart Device projects behaved differently than the same syntax expressed in a VB desktop app or a C# Smart Device app. As you'll recall, the key to understanding the issue is to view the LINQ query as it appears when transformed into the method form.

When showing the method form of the LINQ statements in Tuesday's post, I used C# in both cases so that the comparison would be consistent. Since then, I've received a few requests asking me to show the method form of the LINQ statements expressed in VB … So this post does exactly that.

Here's the LINQ query with the Select keyword

Dim selectedRows = From order In NorthwindDataSet.Orders _
Where order.Ship_Country = "UK" _
Select order

And here's how the query appears when transformed into the method form

Dim selectedRows = NorthwindDataSet.Orders.Where(Function(order) order.Ship_Country = "UK").Select(Function(order) order)

Here's the LINQ query without the Select keyword

Dim selectedRows = From order In NorthwindDataSet.Orders _
Where order.Ship_Country = "UK"

And here's how that query appears when transformed into the method form

Dim selectedRows = NorthwindDataSet.Orders.Where(Function(order) order.Ship_Country = "UK")

Alright, that pretty much closes out this subject. To make information about this issue as widely available as I can, I'm also posting a short "How Do I" video on the Device's "How Do I" page. The videos usually go live about a month after I upload them so the video corresponding to these posts should appear on the Devices "How Do I" page sometime in March '08.


Posted Feb 07 2008, 10:15 AM by jim-wilson

Comments

Freesc wrote re: LINQ in VB Device Projects – One last post
on 02-08-2008 3:33 AM
Thanks for sharing~
I'm looking forward to your vedio~

Add a Comment

(required)  
(optional)
(required)  
Remember Me?