title: Trying to pivot data using linq
body: <p>I have the following class structure:</p>
  
  <pre><code> public class TaskLog
   {
      public DateTime LogDate { get; set; }
      public string Robot { get; set; }
      public string Task { get; set; }
      public Enums.ProbeDataState State { get; set; }
  
      public TaskLog()
      {
      }
  }
  </code></pre>
  
  <p>I created a generic list as follows:</p>
  
  <pre><code>List&lt;TaskLog&gt; Logs;
  </code></pre>
  
  <p>My output:</p>
  
  <pre><code>Robot   Date                    State
  ---------------------------------------------
  aaa     8/5/2013 12:00:00 AM    Task:1=fileDeltaFailed
  aaa     8/5/2013 12:00:00 AM    Task:2=fileDeltaFailed
  aaa     8/5/2013 12:00:00 AM    Task:4=fileDeltaFailed
  bbb     8/5/2013 12:00:00 AM    Task:1=fileDeltaFailed
  bbb     8/5/2013 12:00:00 AM    Task:2=fileDeltaFailed
  bbb     8/5/2013 12:00:00 AM    Task:4=fileDeltaFailed
  </code></pre>
  
  <p>However I would like to group the tasks and state as follows:</p>
  
  <pre><code>                                Tasks
  Robot   Date                    1                 2                4
  aaa     8/5/2013 12:00:00 AM    fileDeltaFailed   fileDeltaFailed  fileDeltaFailed 
  bbb     8/5/2013 12:00:00 AM    fileDeltaFailed   fileDeltaFailed  fileDeltaFailed
  </code></pre>
  
  <p>I tried using the groupby with no luck, and quite stuck.</p>
  
  <p>e.g.</p>
  
  <pre><code> var dataQuery = Logs.Where(w =&gt; w.LogDate &gt;= start &amp;&amp; w.LogDate &lt;= finish).GroupBy(g =&gt; g.LogDate).Select(t =&gt; new
              {
                  LogDate = t.Key,
                  Details = t.OrderBy(o =&gt; o.Robot)
              }).ToList();
  </code></pre>