Current DataTable
需要计算一周中每天记录的数据量
期望的输出
这有什么问题:
var res = from c in dtHour.AsEnumerable()
group c by c.Field<string>("Day Logged") into day
let count = day.Count()
select new {
day_s = day.Count()
};
Console.WriteLine(res);
代码未提供所需的输出。
var collection = dtHour.AsEnumerable()
.GroupBy(item => item.Field<string>("Day Logged"))
.Select(item => new { DayOfWeek = item.Key, Count = item.Count());
要按所需方式打印,请执行以下操作:
Console.WriteLine("Day of week - Count");
foreach(var item in collection)
{
Console.WriteLine(item.DayOfWeek + " - " + item.Count);
}