title: LINQ multiple group by, how to fill in dictionary?
body: <p>I'm trying to retrieve a dataset from RavenDB, group it by several categories and then store it per group in a dictionary. The retrieval and groupby have been solved. However, I'm stuck on how to put the combined group (group on 4 variables) into a dictionary. So in other words: the dictionary needs to be filled with each distinct name/year/month/day combination. I need this to later on display it in a graph - that part is already covered.</p>
  
  <pre><code>Dictionary&lt;string, int&gt; chartInformation = new Dictionary&lt;string, int&gt;();
  List&lt;string&gt; xAxisCategories = new List&lt;string&gt;();
  
  if (model.Period.Value == Timespan.Day)
  {
      var groupedRecords = transformedRecords.GroupBy(x =&gt; new
      {
          x.Name, 
          x.DateTo.Value.Year, 
          x.DateTo.Value.Month, 
          x.DateTo.Value.Day
      });
  
      foreach (var recordGroup in groupedRecords)
      {
  
          if (!chartInformation.ContainsKey(recordGroup.Key.Name, 
              recordGroup.Key.Year, recordGroup.Key.Month, recordGroup.Key.Day)) 
          // how to do this properly 
          {
              chartInformation.Add(recordGroup.Key.?, 0);
          }
  
          if (!xAxisCategories.Contains(recordGroup.Key.?))
          {
              xAxisCategories.Add(recordGroup.Key.?);
          }
  
          foreach (var record in recordGroup)
          {
              //filling stuff here
          }
      }
  }
  </code></pre>