我有一个动态LINQ查询,如下所示。
var results=DataTable.AsEnumerable().AsQueryable()
.Select(selectObjStr)
.GroupBy("new (Country,City)", "it")
.Select("new (Key.Country as Country, Key.City as City)");
导致
[0] = {Country=India, City=Bangalore}
[1] = {Country=India, City=Mangalore}
[2] = {Country=USA, City=LA}
如何从结果中访问每个关键项?我试过像
foreach(var row in results)
{
//but row does not have key column Country or city
}
请帮帮我
答案 0 :(得分:0)
怎么样
for(int i =0; i < results.Count();i++)
{
results[i].Country;
}
尝试,但不确定