title: How to get a Dictionary<string, List<Object> with LINQ?
body: <p>I have an object that looks like this:</p>
  
  <pre><code>class Model
  {
     public string Category {get;set;}
     public string Description {get;set;}
  }
  </code></pre>
  
  <p>Currently I am getting the whole list of those objects with Linq, and then manually setting up a dictionary, like this:</p>
  
  <pre><code>   List&lt;Model&gt; models = //get list from repository and then with linq order them by category and description
  
  Dictionary&lt;string, List&lt;Model&gt;&gt; dict= new Dictionary&lt;string, List&lt;Model&gt;&gt;();
  
              foreach (var m in models)            {
                  if (dict.ContainsKey(m.Category))
                  {
                      dict[m.Category].Add(m);
                  }
                  else
                  {
                      dict.Add(m.Category, new List&lt;Model&gt; { m });
                  }    
              }
  </code></pre>
  
  <p>this way I can access all of the models of a certain category by using the keys.</p>
  
  <p>Is there a way to generate the dictionary straight with a LINQ query?</p>
  
  <p>Thanks!</p>