Differences in LINQ syntax between VB.Net and C#

Viewed 6315

Again, just out of curiosity:

After I have programmed several projects in VB.Net I to my surprise discovered that there are some more than subtle differences between C# and VB.NET LINQ usage. For example, if we want to group elements by multiple properties (columns) we need to create a new anonymous type explicitly:

var procs = from c in Process.GetProcesses() 
            group c by new {c.BasePriority, c.Id} into d 
            select d;

whereas in VB.NET more straightforward syntax will already do:

Dim b = From c In Process.GetProcesses()
        Group c By c.BasePriority, c.Id Into Group
        Select Group

So, one does not need to create a type with "new" here.

What are the other differences? Is there any good comparison between the LINQ syntax in C# and VB.NET?

2 Answers
Related