LINQ pad 在结果末尾显示 SUM

LINQ pad is showing SUM at end of result

当我 运行 LINQ PAD 的以下查询然后看到它在结果末尾显示总和。这是完整的代码,它正在运行。

void Main()
{
    var csvlines = File.ReadAllLines(@"M:\smdr(backup08-06-2015).csv");
var csvLinesData = csvlines.Skip(1).Select(l => l.Split(',').ToArray());

// i am assuming that line[7] is the Party1Name Column
// now you have a (sorted) group with n "members" (ACC, Sales, ..., n )
var groupOfUser = from line in csvLinesData 
                  where  !line[12].Contains("VM") && !line[12].Contains("Voice Mail")
                  group line by line[12] into newGroup 
                  orderby newGroup.Key 
                  select newGroup;

// The Key of your userOfGrp is the Name e.g. "ACC"
// i am assuming that x[4] is the direction Column
// I count all I or O and put them into the new User
var user = (from userOfGrp in groupOfUser
            select
                new User()
                    {
                        CSRName = userOfGrp.Key,
                        Incomming = userOfGrp.Count(x => x[4] == "I"),
                        Outgoing = userOfGrp.Count(x => x[4] == "O")
                    }).ToList();
                    user.Dump();
}

class User
{
    public string CSRName;
    public int Outgoing;
    public int Incomming;
    public int calltransfer;
}

我只是想知道当字段类型为数字时总是在末尾显示总和是 linq pad 的功能吗?或者我的 linq 查询中有显示总和的东西。

我问是因为刚开始使用 linq。谢谢

我的屏幕截图 attached.i 还在图像中放置了箭头以指示我正在谈论的区域。

LINQad 将在其“结果”选项卡中 return 结果,任何枚举都将在其蓝色框的顶部显示如下内容:

IEnumerable<EventLogEntry> (114 items)

取决于确切的类型。最后的计数是 LINQPad 序列化显示数据时的一个特性,它是计数而不是总和。

编辑:现在我可以看到你所谈论的不同结果的图片,是的,这也是 LINQPad 的一个功能(和总和)。

这是 LINQPad 的一个功能,不是 LINQ 的。

您可以在 LINQPad 中的 SQL 查询中看到相同的功能。