Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does VB have more LINQ keywords than C#?

Tags:

c#

vb.net

linq

Why does VB have more LINQ keywords than C#?

like image 606
JoelFan Avatar asked Jun 24 '09 17:06

JoelFan


2 Answers

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

  • Distinct
  • Skip / Skip While
  • Take / Take While
  • Aggregate

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!)

like image 91
JaredPar Avatar answered Oct 26 '22 14:10

JaredPar


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.

like image 36
Andrew Hare Avatar answered Oct 26 '22 13:10

Andrew Hare