title: Issue in Linq to object where clause : the condition is bypassed
body: <p>
  Hi everyone,</p>
  
  <p>Today it is my first post on my favourite C# helping ressources web site. I'm glade to join the community.</p>
  
  <p>Here is my problem, I would like to call .Select linq clause to create a list of a struct after filtering a list of double values with the .Where clause, but the filtering conditions don't seem being evaluated or they return always true.<br>
  Please view my code to well understand the issue :</p>
  
  <pre class="lang-cs prettyprint-override"><code>string[] msgNames = new string[] { "de", "vf", "ze", "ki", "vt", "er" };
  double[] prevCounters = new double[] { 154.0, 24588.0, 4547.0, 788.0, 1455.0, 24577.0 };
  double[] counters = new double[] { 8548.0, 54854.0, 54854.0, 44.0, 121.0, 48547.0 };
  double[] lenValues = new double[] { 1.0, 2.0, 0.0, 4.0, 5.0, 0.0 };
  
  BufferInfo[] positiveLenValues = counters
      .Where((c, it) =&gt; lenValues[it] &gt;= 1.0 &amp;&amp; prevCounters[it] != c)
      .Select((c, it) =&gt;
      {
          prevCounters[it] = c;
  
          return new BufferInfo()
          {
              Name = msgNames[it],
              Length = lenValues[it]
          };
      }).ToArray();
  </code></pre>
  
  <p>Perhaps I misunderstood the linq usage, but at the end the returned BufferInfo[] contains all the values while there are some values less than 1.0 in the lenValues array. For information there is no concurrent access to this code block.. The local variables over the linq bloc are usually instanciated dynamically (retuned by an external assembly, from National Instruments), it's here just for you to know.</p>
  
  <p>For example, the same bahaviour but with a for loop, works as well :</p>
  
  <pre class="lang-cs prettyprint-override"><code>List&lt;BufferInfo&gt; myInfos = new List&lt;BufferInfo&gt;();
  
  for (int i = 0; i &lt; 6; i++)
  {
      if (lenValues[i] &gt;= 1.0 &amp;&amp; prevCounters[i] != counters[i])
      {
          oldCounters[i] = counters[i];
          myInfos.Add(new BufferInfo()
                      {
                          Length = lenValues[i],
                          Name = msgNames[i]
                      });
      }
  }
  
  BufferInfo[] buffers = myInfos.ToArray();
  </code></pre>
  
  <p>I don't care to use linq or not, I just want to understand why it fails.<br>
  Please explain me why i've got these strange results.</p>
  
  <p>Best regards,<br>
  Lun@ir.</p>