title: Convert byte array to array segments of a certain length
body: <p>I have a byte array and I would like to return sequential chuncks (in the form of new byte arrays) of a certain size.</p>
  
  <p>I tried:</p>
  
  <pre><code>originalArray = BYTE_ARRAY
  var segment = new ArraySegment&lt;byte&gt;(originalArray,0,640); 
  byte[] newArray = new byte[640];
  for (int i = segment.Offset; i &lt;= segment.Count; i++)
  {
  newArray[i] = segment.Array[i];
  }
  </code></pre>
  
  <p>Obviously this only creates an array of the first 640 bytes from the original array. Ultimately, I want a loop that goes through the first 640 bytes and returns an array of those bytes, then it goes through the NEXT 640 bytes and returns an array of THOSE bytes. The purpose of this is to send messages to a server and each message must contain 640 bytes. I cannot garauntee that the original array length is divisible by 640.</p>
  
  <p>Thanks</p>