Microsoft.Protocols.TestSuites.Common.Common.CompareByteArray C# (CSharp) Method

CompareByteArray() public static method

Compare two byte arrays
public static CompareByteArray ( byte bytes1, byte bytes2 ) : bool
bytes1 byte The first byte array
bytes2 byte The second byte array
return bool
        public static bool CompareByteArray(byte[] bytes1, byte[] bytes2)
        {
            if (bytes1 == null || bytes2 == null)
            {
                if (bytes1 == null && bytes2 == null)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }

            if (bytes1.Length == bytes2.Length)
            {
                for (int i = 0; i < bytes1.Length; i++)
                {
                    if (bytes1[i] != bytes2[i])
                    {
                        return false;
                    }
                }
            }
            else
            {
                return false;
            }

            return true;
        }
Common