0

I've a list of tasks. Ie I've struct like

struct Task
{
    public DateTime Completed { get; set; }
    public string TaskKind { get; set; }
    public float Effort { get; set; }
}

And I've a IList<Task>.

Now I want to group the tasks based on the date and group by TaskKind on each day with the summed effort. For eg for I want to print like the below:

01-09-09     Design:10     Coding:5    Coordination:15
02-09-09     Coding:5       Meeting:2

Can anyone help me in constructing a LINQ query to achieve this?

ekad
  • 14,436
  • 26
  • 44
  • 46
Madhan Ganesh
  • 2,273
  • 2
  • 24
  • 19

1 Answers1

0

This is a combination of a simple aggregate (COUNT by TaskKind) and a PIVOT. Take a look at this question: Is it possible to Pivot data using LINQ?

Community
  • 1
  • 1
Dave Swersky
  • 34,502
  • 9
  • 78
  • 118