如何遍历动态sql GroupBy创建的组(并读取其数据)
示例代码:
List<dtoMyAlbum> listAlbums = new List<dtoMyAlbum>();
for (int i = 0; i < 5000; i++)
{
dtoMyAlbum album = new dtoMyAlbum
{
Author = "My Author",
BookID = i,
CurrSymbol = "USD",
Price = 23.23,
Shop = i % 3 == 0 ? "TESCO" : "HMV"
};
listAlbums.Add(album);
}
IQueryable<dtoMyAlbum> mydata = listAlbums.AsQueryable();
var mydataGrouped = mydata.GroupBy("Shop", "it");
foreach (var group in mydataGrouped)
{
var count = group.Count(); <-- HOW TO MAKE THIS WORK?
var firstEntry = group[0] <-- HOW TO MAKE THIS WORK? etc.
}