linq group by statement不工作

fc1*_*123 0 .net c# linq entity-framework linq-to-sql

我有一个linq声明如下,

var v1 = from s in context.INFOONEs group s by s.DATET into xyz select xyz;
Run Code Online (Sandbox Code Playgroud)

我想跟着显示结果

foreach (var x in v1)
{
    Console.WriteLine(x.);
}
Run Code Online (Sandbox Code Playgroud)

但是当我输入x时,intellisence没有显示列.

我做错了什么?什么是实现我想要实现的目标的正确方法?

谢谢

Sel*_*enç 9

因为x中没有列.每个组下都有一些记录.所以你需要获得这些记录:

foreach (var x in v1)
{
    Console.WriteLine(x.Key); // display the Key of current group
    foreach(var item in x) // iterate over the records in the group
    {
       Console.WriteLine(item.) // here you can access your columns
    }
}
Run Code Online (Sandbox Code Playgroud)