title: How to group a list of objects into a dictionary?
body: <p>I have list of:</p>
  
  <pre><code>public class Item
  {
     public int FirstId { get; set; }
     public int SecondId { get; set; }
     public int Sequence { get; set; }
  }
  </code></pre>
  
  <p>A sample list might be:</p>
  
  <pre><code>var list = new List&lt;Item&gt;();
  list.Add( new Item{ FirstId = 1, SecondId = 10, Sequence = 1 } );
  list.Add( new Item{ FirstId = 2, SecondId = 10, Sequence = 1 } );
  list.Add( new Item{ FirstId = 2, SecondId = 11, Sequence = 2 } );
  list.Add( new Item{ FirstId = 3, SecondId = 10, Sequence = 1 } );
  list.Add( new Item{ FirstId = 4, SecondId = 10, Sequence = 2 } );
  list.Add( new Item{ FirstId = 4, SecondId = 11, Sequence = 1 } );
  </code></pre>
  
  <p>I need to group the items by FirstId and sort each group by Sequence. The result should be:</p>
  
  <pre><code>Dictionary&lt;int, IEnumerable&lt;int&gt;&gt;();
  </code></pre>
  
  <p>where the key is FirstId, and value is the list of SecondId ordered by Sequence. So the result of the above should be:</p>
  
  <pre><code>Key (int), Value (IEnumerable&lt;int&gt;)
  1, (10)
  2, (10, 11)
  3, (10)
  4, (11, 10)
  </code></pre>
  
  <p>Currently I have the following:</p>
  
  <pre><code>var items = from t in tags
              group t by t.FirstId into g
              orderby g.Key
              select g;
  </code></pre>
  
  <p>How can I expand on the above to achieve what I need?</p>