title: Different behaviour between Join and SelectMany after replacing one of the sets
body: <p>I hope that someone can shed a light on the (to me) unexpected behavioral difference between the two (result wise) equal queries.<br>
  A small program can be worth a thousand words, so here goes :  </p>
  
  <pre><code>static void Main(string[] args)  
  {  
    var l1 = new List&lt;int&gt; { 1, 2, 3 };  
    var l2 = new List&lt;int&gt; { 2, 3, 4 };  
  
    var q1 =  // or var q1 = l1.Join(l2, i =&gt; i, j =&gt; j, (i, j) =&gt; i);
        from i in l1  
        join j in l2
        on i equals j
        select i; 
  
    var q2 = //or var q2 = l1.SelectMany(i =&gt; l2.Where(j =&gt; i == j));  
        from i in l1
        from j in l2
        where i == j
        select i;
  
    var a1 = q1.ToList(); // 2 and 3, as expected
    var a2 = q2.ToList(); // 2 and 3, as expected
  
    l2.Remove(2);
  
    var b1 = q1.ToList(); // only 3, as expected  
    var b2 = q2.ToList(); // only 3, as expected
  
    // now here goes, lets replace l2 alltogether.   
    // Afterwards, I expected the same result as q1 delivered...  
  
    l2 = new List&lt;int&gt; { 2, 3, 4 };
  
    var c1 = q1.ToList(); // only 3 ? Still using the previous reference to l2 ?  
    var c2 = q2.ToList();  // 2 and 3, as expected  
  }
  </code></pre>
  
  <p>Now I know that Join internally uses a lookup class to optimize performance, and without too much knowledge, my guess is that the combination of that with captured variables might cause this behavior, but to say I really understand it, no :-)<br>
  Is this an example of what Joel calls "a leaky abstraction" ?</p>
  
  <p>Cheers,
  Bart</p>