object.Equals判断的是对象的引用是否相等,不能判断数组内容是否相等
可使用Enumerable.SequenceEqual()判断内容
byte[] a1 = new byte[] { 1, 2, 3, 4, 5, 6 };
byte[] a2 = new byte[] { 1, 2, 3, 4, 5, 6 };
byte[] a3 = new byte[] { 1, 2, 3, 4, 6, 6 };
Console.WriteLine(Enumerable.SequenceEqual(a1, a2));
Console.WriteLine(Enumerable.SequenceEqual(a1, a3));
Console.WriteLine(Enumerable.SequenceEqual(a2, a3));
Output:
True
False
False