IEnumerable<IGrouping<string, ChronicIcd>> query = chronicList.GroupBy(pet => pet.ChronicName); if (query != null) { result = new List<List<ChronicIcd>>(); foreach (IGrouping<string, ChronicIcd> info in query) { List<ChronicIcd> sl = info.ToList<ChronicIcd>();//分组后的集合 result.Add(sl); } }
mark一下
对list集合进行分组