title: How to call memcmp() on two parts of byte[] (with offset)?
body: <p>I want to compare parts of <code>byte[]</code> efficiently - so I understand <code>memcmp()</code> should be used.</p>
  
  <p>I know I can using PInvoke to call <code>memcmp()</code> - <a href="https://stackoverflow.com/questions/43289/comparing-two-byte-arrays-in-net">Comparing two byte arrays in .NET</a></p>
  
  <p>But, I want to compare only parts of the <code>byte[]</code> - using offset, and there is no <code>memcmp()</code> with offset since it uses pointers.</p>
  
  <pre><code>int CompareBuffers(byte[] buffer1, int offset1, byte[] buffer2, int offset2, int count)
  {
    // Somehow call memcmp(&amp;buffer1+offset1, &amp;buffer2+offset2, count)
  }
  </code></pre>
  
  <p>Should I use C++/CLI to do that?</p>
  
  <p>Should I use PInvoke with IntPtr? How?</p>
  
  <p>Thank you.</p>