Back to .NET: amazing what you stumble across when writing software. Assume you have 2 arrays and want to compare them:
byte[] array1 = new byte[] { 1, 2, 3 };
byte[] array2 = new byte[] { 1, 2, 3 };
array1.Equals(array2);

All you want to do is determine if the two arrays contain the same elements. The problem with above pseudo-code: it returns “false” as result! The arrays are considered to be different instances of the same data – and thus not equal.

Quick and dirty workaround for small arrays: convert both arrays to a Base64 string and compare their values.

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top