LINQ Group By Issue

I use VB.NET and DataSets; I have two tables and an attitude. I am querying the first table, but I cannot use Group Byin any field of the table. Here is the error I see:

The definition of the 'GroupBy' method is not available in this context

And my code is as follows:

Dim Groups = From n In dataSetTableAsEnumerable _
   Group By n.filedName  Into Group

Thanks for any help.

+3
source share
2 answers

You need to say which thing you are grouping, for example:

 Dim Groups = From n In dataSetTableAsEnumerable _
              Group n By n.filedName  Into Group _
              Select Group

In your case, you need Group n By, not just Group By.

+1
source

Imports System.Linq to the top of your vb code file.

+1
source

Source: https://habr.com/ru/post/1760983/


All Articles