我想通過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