标签:
1 var ArticleList = new Services.Data.SearchService().GetArticleBaseList(ref param); 2 IEnumerable<IGrouping<string, Models.Data.ArticleBase>> Collection = ArticleList.GroupBy(p => p.YearIssue).ToList();//DBYL 3 foreach (IGrouping<string, Models.Data.ArticleBase> info in Collection) 4 { 5 List<Models.Data.ArticleBase> sl = info.ToList<Models.Data.ArticleBase>();//分组后的集合 6 }
关键是类型IEnumerable<IGrouping<string, Models.Data.ArticleBase>>的使用,然后是就是简单的遍历了
标签:
原文地址:http://www.cnblogs.com/itboy-2009/p/4729207.html