41
Hi I have a list of element of class type class1 as show below. How do I group them into a
Dictionary<int,List<SampleClass>> based on the groupID
class SampleClass
{
public int groupID;
public string someData;
}
I have done this way:
var t =(from data in datas group data by data.groupID into dataGroups select dataGroups).ToDictionary(gdc => gdc.ToList()[0].groupID, gdc => gdc.ToList());
Is there a better way of doing thiss