一种就是象2楼一样老实逐一判断
- C# code
static bool BytesEquals(byte[] array1, byte[] array2) { if (array1.Length != array2.Length) return false; for (int i = 0; i < array1.Length; i++) if (array1[i] != array2[i]) return false; return true; }
另一种可以使用内存比较的API
- C# code
[DllImport("ntdll.dll")] public static extern int RtlCompareMemory(IntPtr Destination, IntPtr Source, int Length);