title: Efficient C# byte queue for parsing stream of bytes for binary message packets
body: <p>I'm trying to replace what I would usually implement as a circular-buffer+.  The function of the queue is to buffer incoming bytes (eg. from serial port or some other stream of data), whilst a parser examines bytes in the queue and detects and extracts message packets.</p>
  <p>Criteria:</p>
  <ul>
  <li>can grow (ie not fixed-sized)</li>
  <li>
  <blockquote>
  <p>= 1 bytes can be enqueued at a time</p>
  </blockquote>
  </li>
  <li>
  <blockquote>
  <p>= 1 bytes can be dequeued at a time</p>
  </blockquote>
  </li>
  <li>efficient</li>
  </ul>
  <p>I'm tempted just to use</p>
  <pre><code>System.Collections.Generic.Queue&lt;byte&gt;
  </code></pre>
  <p>... but I'm not sure if this is the most efficient type to use.  Any suggestions?</p>
  <p>Are there any smarter ways of doing what I'm trying to do?  (Eg. Interesting suggestions <a href="http://www.eggheadcafe.com/software/aspnet/32365893/buffering-tcpip-data.aspx" rel="noreferrer">here</a>)</p>
  <p>Thanks for your suggestions &amp; input.</p>
  <p>Prembo.</p>