我想有效地比较部分byte[]
- 所以我理解memcmp()
应该使用。
我知道我可以使用 PInvoke 来调用memcmp()
-在 .NET 中比较两个字节数组
但是,我只想比较部分byte[]
- 使用偏移量,并且没有memcmp()
使用偏移量,因为它使用指针。
int CompareBuffers(byte[] buffer1, int offset1, byte[] buffer2, int offset2, int count)
{
// Somehow call memcmp(&buffer1+offset1, &buffer2+offset2, count)
}
我应该使用 C++/CLI 来做到这一点吗?
我应该将 PInvoke 与 IntPtr 一起使用吗?如何?
谢谢你。