tags:

views:

103

answers:

1

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?

Thanks. Madhan

A: 

This is a combination of a simple aggregate (COUNT by TaskKind) and a PIVOT. Take a look at this question: http://stackoverflow.com/questions/167304/is-it-possible-to-pivot-data-using-linq

Dave Swersky