title: How to strip blocks out of an IEnumerable?
body: <p>I'm posting this more as a learning exercise than because I need to change the implementation away from an imperative loop. My question is how would one convert this loop to LINQ? Given an input IEnumerable of bytes which is considered to be in "blocks" of 8 bytes. The output IEnumerable should have any blocks which contain a 0 removed.</p>
  
  <p>Rough Imperative implementation</p>
  
  <pre><code>    private static IEnumerable&lt;byte&gt; StripBlocksWithZeroes(IEnumerable&lt;byte&gt; input)
      {
          var stripped = new List&lt;byte&gt;();
          var inputArray = input.ToArray();
          for (int i = 0; i &lt; inputArray.Length; i += 8)
          {
              if (inputArray[i + 0] != 0 &amp;&amp;
                  inputArray[i + 1] != 0 &amp;&amp;
                  inputArray[i + 2] != 0 &amp;&amp;
                  inputArray[i + 3] != 0 &amp;&amp;
                  inputArray[i + 4] != 0 &amp;&amp;
                  inputArray[i + 5] != 0 &amp;&amp;
                  inputArray[i + 6] != 0 &amp;&amp;
                  inputArray[i + 7] != 0)
              {
                  stripped.Add(inputArray[i + 0]);
                  stripped.Add(inputArray[i + 1]);
                  stripped.Add(inputArray[i + 2]);
                  stripped.Add(inputArray[i + 3]);
                  stripped.Add(inputArray[i + 4]);
                  stripped.Add(inputArray[i + 5]);
                  stripped.Add(inputArray[i + 6]);
                  stripped.Add(inputArray[i + 7]);
              }
          }
          return stripped;
      }
  </code></pre>