title: Combine duplicate selections into a single result
body: <p>In addition to my <a href="https://stackoverflow.com/questions/26578427/how-to-merge-trees-and-sum-counts-using-linq">previous question</a>, I still have no concrete solution to my problem.</p>
  
  <p>I have 2 classes like this:</p>
  
  <pre><code>public class Product
  {
      public Product()
      {
          Options = new List&lt;Option&gt;();
      }
      public string Name { get; set; }
      public int ID { get; set; }
      public List&lt;Option&gt; Options { get; set; }
  }
  
  public class Option
  {
      public int SubID { get; set; }
      public string SubName { get; set; }
      public int ListBoxID { get; set; }
      public decimal Price { get; set; }
      public bool IsSelected { get; set; }
  }
  </code></pre>
  
  <p>Which are used in a list like this:</p>
  
  <pre><code>List&lt;Product&gt; Products { get; set; }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/TwVGl.png" alt="enter image description here"></p>
  
  <p>When a user selects a product on the left (which are always with the same properties), it's internal <code>List&lt;Optie&gt;</code> will get loaded in 4 different <code>ListBox's</code>, Filtered by <code>ListBoxID</code>.</p>
  
  <p>Now, if a user selects the same options in 2 products, how can I convert them into one result using linq?</p>
  
  <p>e.g. 4 identical products are loaded, user selects the same options for 2 products, then my result would be:</p>
  
  <p><code>2x Product
      2x lookbrood
      2x ollema
      2x fitness broodje
      2x testtest</code></p>
  
  <p>If the 2 other products have different selections, these might be the result for them:</p>
  
  <p><code>2x Product
      2x ciabatta broodje
      2x ollema
      2x slagroom
      2x smos</code></p>
  
  <p>I always need the quantity loaded into <code>Products</code>:
  e.g.: 6 products are loaded, then my combinations can be:</p>
  
  <p><code>3x Product
      3x ciabatta broodje
      3x ollema
      3x slagroom
      3x smos</code></p>
  
  <p><code>3x Product
      3x Some other option 1
      3x Some other option 2
      3x Some other option 3
      3x Some other option 4</code></p>
  
  <p>or</p>
  
  <p><code>2x Product
      2x Some option 1
      2x Some option 2
      2x Some option 3
      2x Some option 4</code></p>
  
  <p><code>2x Product
      2x Some other option 1
      2x Some other option 2
      2x Some other option 3
      2x Some other option 4</code></p>
  
  <p><code>2x Product
      2x Some other option 1
      2x Some other option 2
      2x Some other option 3
      2x Some other option 4</code></p>
  
  <p>This is the best explanation I can give, I hope the image helps.</p>