I want to compare parts of byte[]
efficiently - so I understand memcmp()
should be used.
I know I can using PInvoke to call memcmp()
- Comparing two byte arrays in .NET
But, I want to compare only parts of the byte[]
- using offset, and there is no memcmp()
with offset since it uses pointers.
int CompareBuffers(byte[] buffer1, int offset1, byte[] buffer2, int offset2, int count)
{
// Somehow call memcmp(&buffer1+offset1, &buffer2+offset2, count)
}
Should I use C++/CLI to do that?
Should I use PInvoke with IntPtr? How?
Thank you.