C# 对比两个byte[]是否一样

[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
        static extern int ByteEquals(byte[] b1, byte[] b2, long count);

        /// <summary>
        /// 比较数组
        /// </summary>
        /// <param name="b1"></param>
        /// <param name="b2"></param>
        /// <returns></returns>
        static bool ByteArrayCompare(byte[] b1, byte[] b2)
        {
            return b1.Length == b2.Length && ByteEquals(b1, b2, b1.Length) == 0;
        }

 

posted @ 2022-01-11 15:12  LuoCore  阅读(1243)  评论(0编辑  收藏  举报