title: Getting head and tail from IEnumerable that can only be iterated once
body: <p>I have a sequence of elements. The sequence can only be iterated once and can be &quot;infinite&quot;.</p>
  <p>What is the best way get the head and the tail of such a sequence?</p>
  <p><strong>Update: A few clarifications that would have been nice to include in the original question :)</strong></p>
  <ul>
  <li><p>Head is the first element of the sequence and tail is &quot;the rest&quot;. That means the the tail is also &quot;infinite&quot;.</p>
  </li>
  <li><p>When I say infinite, I mean &quot;very large&quot; and &quot;I wouldn't want to store it all in memory at once&quot;. It could also have been actually infinite, like sensor data for example (but it wasn't in my case).</p>
  </li>
  <li><p>When I say that it can only be iterated once, I mean that generating the sequence is resource heavy, so I woundn't want to do it again. It could also have been volatile data, again like sensor data, that won't be the same on next read (but it wasn't in my case).</p>
  </li>
  </ul>