title: C# LINQ Zipping 2 list of lists based on uniqueness of objects
body: <p>I am trying to zip 2 lists of lists of objects - only where the resulting zipped list would contain lists of distinct objects (list 2's lists sometimes have duplicate objects when compared to list 1). The count of objects in the resultant list must be maintained, meaning we can't have lists of differing sizes. The number of lists in list 1 is greater the number in list 2. Which would mean repeatedly going through list 2 when zipping.</p>
  
  <p>The above is represented using loops below. Is this possible using only linq?</p>
  
  <pre><code>//this list of list contains the larger number of elements to which the 2nd list of list needs to be joined
  List&lt;List&lt;object&gt;&gt; FullList = new List&lt;List&lt;object&gt;&gt;(); //is not empty - instantiated with some list
  
  //2nd list of list - contains duplicates of the 1st list in terms of the objects in the underlying list
  List&lt;List&lt;object&gt;&gt; comboBaseList = new List&lt;List&lt;object&gt;&gt;(); //is not empty - instantiated with some list
  List&lt;List&lt;object&gt;&gt; comboList = comboBaseList;
  
  //need to zip lists where there are no duplicate objects in the 2nd list's list, the count of the 1st list of list remains the same as FullList
  List&lt;List&lt;object&gt;&gt; finalList = new List&lt;List&lt;object&gt;&gt;(); //empty - meant to hold final combined list
  
  int i = 0;
  
  foreach iList in FullList
  {
      if (i &lt; comboList.count)
      {
          while (iList.Select(x =&gt; x.Id).Contains(comboList[i].Select(y =&gt; y.Id)))
          {
              i += 1;
          }
          finalList.Add(iList.Zip(comboList[i], (x, y) =&gt; x.Union(y))); //**CAN WE BYPASS THE LOOPS AND JUST USE LINQ?
          comboList.RemoveAt(i);
          i = 0;
      }
      else
      {
          comboList = comboBaseList;
          i = 0;
      }
  }
  </code></pre>
  
  <p>To simplify the data I'll use lists of lists of integers - which could be the Id's of the objects in my case</p>
  
  <pre><code>FullList = 
  (
  {1,2,3},
  {2,5,6},
  {7,8,9}
  )
  
  comboList = 
  (
  {2,5},
  {8,9}
  )
  </code></pre>
  
  <p>I want to zip the above lists to yield the resultant as below - Note that there are 3 results as per FullList and the undelying lists have distinct integers</p>
  
  <pre><code>finalList =
  {
   {1,2,3,8,9},
   {2,5,6,8,9},
   {7,8,9,2,5}
  }
  </code></pre>