标签:
var items = List<实体>;
var models = items.GroupBy(r => r.分类字段).ToDictionary(d => d.Key, d => d.ToList());
分类字段值相同的数据都会归为一类。主键为key
具体取值方法
foreach(var model in models)
{
var key = model.key;
var value = model.value;
}
标签:
原文地址:http://www.cnblogs.com/afei9527/p/4242048.html