.Maui Blog

VB.Net – Group by and count with Linq

Dim result = From c In db.Contest
             Group c By Key = c.UserId Into Group
             Select userid = Key, conteggio = Group.Count()

For Each r In result
    Console.WriteLine(r.userid)
Next
Exit mobile version