src/Inedo.UPack/AH.cs
/// <summary>
/// Returns a value indicating whether two byte arrays contain the same data.
/// </summary>
/// <param name="array1">The first array.</param>
/// <param name="array2">The second array.</param>
/// <returns>True if arrays contain the same data; otherwise false.</returns>
Returns a value indicating whether two byte arrays contain the same data.
Returns a value indicating whether two byte arrays contain the same data .
public static bool Equals(byte[] array1, byte[] array2)
        {
            if (ReferenceEquals(array1, array2))
                return true;
            if (ReferenceEquals(array1, null) | ReferenceEquals(array2, null))
                return false;
            if (array1.Length != array2.Length)
                return false;
            int length = array1.Length;
            unsafe
            {
                fixed (byte* ptr1 = array1)
                fixed (byte* ptr2 = array2)
                {
                    for (int i = 0; i < length; i++)
                    {
                        if (ptr1[i] != ptr2[i])
                            return false;
                    }
                }
            }
            return true;
        }
public static bool Equals ( byte [ ] array1 , byte [ ] array2 ) { if ( ReferenceEquals ( array1 , array2 ) ) return true ; if ( ReferenceEquals ( array1 , null ) | ReferenceEquals ( array2 , null ) ) return false ; if ( array1 . Length != array2 . Length ) return false ; int length = array1 . Length ; unsafe { fixed ( byte * ptr1 = array1 ) fixed ( byte * ptr2 = array2 ) { for ( int i = 0 ; i < length ; i ++ ) { if ( ptr1 [ i ] != ptr2 [ i ] ) return false ; } } } return true ; }
Returns a value indicating whether two byte arrays contain the same data.
Returns a value indicating whether two byte arrays contain the same data .
True if arrays contain the same data; otherwise false.
True if arrays contain the same data ; otherwise false .
array1
byte[]
The first array.
The first array .
array2
byte[]
The second array.
The second array .