title: Remove range from byte array
body: <p>I have a file in a <code>byte[]</code>, and I need to remove <code>0x1000</code> bytes at every <code>x</code> offset (I have a list of offsets). I have some code to do it, but I'm wondering if there is a better way to do it;</p>
  
  <pre><code>private byte[] RemoveHashBlocks(byte[] fileArray, STFSExplorer stfs)
  {
      long startOffset = StartingOffset;
      long endOffset = StartingOffset + Size;
  
      List&lt;long&gt; hashBlockOffsets = new List&lt;long&gt;();
      foreach (xBlockEntry block in stfs._stfsBlockEntry) 
          if (block.IsHashBlock &amp;&amp; (block.BlockOffset &gt;= startOffset &amp;&amp; block.BlockOffset &lt;= endOffset))
              hashBlockOffsets.Add(block.BlockOffset - (hashBlockOffsets.Count * 0x1000));
  
      byte[] newFileAray = new byte[fileArray.Length - (hashBlockOffsets.Count * 0x1000)];
  
      for (int offset = 0; offset &lt; fileArray.Length; offset++)
          if (hashBlockOffsets[0] == offset)
          {
              offset += 0x1000;
              hashBlockOffsets.RemoveAt(0);
          }
          else
              newFileAray[offset] = fileArray[offset];
  
      return newFileAray;
  }
  </code></pre>