1. Home
  2. Computing & Technology
  3. Visual Basic

Readers Respond: You can use either one. Which is easiest for you?
Responses: 1

By , About.com Guide

Microsoft added SQL style syntax to LINQ queries because they believed it would be easier to understand and use. Do you agree? Take Your Pick

Query syntax most of the time

In VB, function syntax can be hard to read due to VB's verbose syntax. Try writing an expression containing multiple generic arguments and a lambda expression and your eyes will go square reading it. I'll use function syntax if a single function call is required but, for longer expressions, I'll almost always use query syntax. In C#, the syntax is more terse so function syntax can be easier to read than the equivalent VB code for longer expressions, so I'll tend to use function syntax more often in C# than i do in VB, although I'll still go for query syntax for longer expressions. VB query syntax also has a couple of advantages over C# query syntax, like the ability to omit the Select clause if all you're selecting is the range variable. VB also has a Distinct keyword, which requires a function call in C#.
—Guest John McIlhinney

Take Your Pick

You can use either one. Which is easiest for you?

Receive a one-time notification when your response is published.

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Using VB.NET
  5. Do you use the SQL or traditional dot notation to code LINQ?>

©2009 About.com, a part of The New York Times Company.

All rights reserved.