对list进行分组

  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集合进行分组

原文地址:https://www.cnblogs.com/jiangyou-lz/p/6928685.html