How do I use "Into" LINQ expression in VB.NET?

Posted by SLC on Stack Overflow See other posts from Stack Overflow or by SLC
Published on 2010-04-19T14:26:20Z Indexed on 2010/04/19 14:33 UTC
Read the original article Hit count: 240

Filed under:
|
|
|

I'm converting from C# this LINQ expression. However, it does not seem to work.

C#

 return (from w in fishSticks
         group w by w.FishQty into g
         orderby g.Key descending
         select g).First().First();

VB

Return (From w In fishSticks
        Group w By w.FishQty Into g()
        Order By g.Key Descending
        Select g).First().First()

Visual Studio turns g into g() itself and then gives me this error:

Definition of method 'g' is not accessible in this context.

Any ideas?

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about LINQ