title: Best Way to Represent Large Byte Array
body: <p>I'm looking for the most efficient way to store and manage a large byte array in memory. I will have the need to both insert and delete bytes from any position within the array.</p>
  
  <p>At first, I was thinking that a regular array was best.</p>
  
  <pre><code>byte[] buffer = new byte[ArraySize];
  </code></pre>
  
  <p>This would allow me to access any byte within the array. I can also resize the array. However, there doesn't appear to be any built-in support for <em>shifting</em> or moving items within the array.</p>
  
  <p>One option is to have a loop to move items one by one but that sounds horribly inefficient in C#. Another option is to create a new array and copy bytes over to the correct position, but that requires copying all data in the array.</p>
  
  <p>Is there no better option?</p>