Check if Two Byte Arrays are Equal

10/11/2014 11:09:44 PM

Checks two byte arrays and determines if they have the same values.

public static bool ByteArrayEquals(byte[] a, byte[] b)
{
	if (a != null && b != null)
	{
		if (a.Length == b.Length)
		{
			for (int x = 0; x < a.Length; x++)
			{
				if (a[x] != b[x])
				{
					return false;
				}
			}

			return true;
		}
	}

	return false;
}