我有一个像
public DespatchGroup(DateTime despatchDate, List<Products> products);
而我正在尝试做...
var list = new List<DespatchGroup>();
foreach (var group in dc.GetDespatchedProducts().GroupBy(i => i.DespatchDate))
{
// group.Values is not correct... how do I write this?
list.Add(new DespatchGroup(group.Key, group.Values);
}
我显然不明白IGrouping
,因为我看不到如何实际访问组内的数据记录!