我想通过Guid(最常用的)来订购一堆记录,然后按这一列进行分组,并采用前3个最常用的Guid。Linq to Entities - GroupBy
IList<Records> dbobjs = dbContext.Records
.OrderByDescending(t => t.Id)
.GroupBy(t => t.Id)
.Take(3)
.ToList();
这不工作......我做错了什么?它的名言:
Cannot implicitly convert type 'System.Collections.Generic.List<System.Linq.IGrouping<System.Guid,DataAccessLayer.Records>>' to 'System.Collections.Generic.IList<DataAccessLayer.Records>'. An explicit conversion exists (are you missing a cast?)
感谢
Id不应该是唯一的吗?因此'GroupBy'没有什么意义,或者我错过了什么? – 2012-02-09 19:34:00