Accepted answer

It will be more efficient to replace:

gdc => gdc.ToList()[0].groupID


gdc => gdc.Key

Other than that, it looks like I would have done.

Alternately, if you are okay with extension methods over LINQ (I personally prefer them), it can be shortened further still with:

var t = data.GroupBy(data => data.groupID).ToDictionary(gdc => gdc.Key, gdc => gdc.ToList());

Related Query

More Query from same tag