tags:

views:

454

answers:

4

Why does VB have more LINQ keywords than C#?

+3  A: 

The VB team decided to create more language extensions than the C# team did (in terms of keywords that translate to standard query operators). I chalk this up to different teams having different design goals.

Fortunately both languages have full access to all of the standard query operators that are available so there is no loss of functionality.

Andrew Hare
I don't sync with you framework (System.Core) is common at all languages.
pho3nix
+13  A: 

If i remember correctly the only 4 keywords that are available to VB.Net and not C# via the query syntax are

VB.Net added these keywords because we felt it would be valuable to our users. We envisioned query syntax being a primary way VB.net users would use LINQ and wanted to enable as many scenarios as possible via the syntax.

I do not know why C# left these out. My speculation is that they didn't feel the scenario justified the cost especially considering the feature is still available via extension methods.

EDIT Added Aggregate and a few others (thanks Dario and Chris!)

JaredPar
Aggregate and its combinations don't exist in C#!
Dario
The one that surprises me the most is distinct ... select distinct flows so naturally.
JP Alioto
Don't forget Skip While and Take While
Chris Dunaway
@Chris, yes forgot about those.
JaredPar
An entirely reasonable speculation. :-)
Eric Lippert
C# guys should have left the whole query syntax out. It makes C# look like FoxPro ;-)
Mehrdad Afshari
A: 

Check if you have Menu

Tools > Options > Text Editor > C# -> Statment Completation -> Hide advanced members

unckecked, if this is check means you have members hidden from you. This is created by VS Team for help and simplify tasks to newbies.

pho3nix
language keywords aren't members; this setting makes no difference whatsoever to the number of language [contextual] keywords
Marc Gravell
Yes its true. But Linq "keyworkds" is on System.Core and and this is a dll in framework that work with vb, c# or else.
pho3nix
I never refer to keywords always members. And Distinct or Distinct or else is all members.
pho3nix
A: 

One keyword that is semi-"LINQ"d to LINQ that C# has that VB doesn't have is yield.

Daniel A. White
Not knocking VB programmers, as I only migrated from VB to C# recently (in the last couple of years)... I speculate that is because a large majority of VB programmers wouldn't grasp the concept of yield much less find a use for it, so the net gain of including it wouldn't outweigh the cost of development and thus wouldn't make good business sense for inclusion.
BenAlabaster