Below is a sample code snippet that demonstrates how to Compare two Array of Bytes for Equality in C# using the Enumerable.SequenceEqual LINQ method.
How to Compare two Array of Bytes for Equality in C#?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GinktageConsoleApps { class Program { static void Main(string[] args) { string InputString = "Ginktage.com - This is an example of How to Compare two Array of Bytes for Equality in C# ?"; byte[] Input1 = new byte[] { 221, 45, 67 }; byte[] Input2 = new byte[] { 2, 22, 222 }; var retValue = CompareByteArray(Input1,Input2); Console.WriteLine(retValue.ToString()); Console.ReadLine(); } public static bool CompareByteArray(byte[] array1, byte[] array2) { return Enumerable.SequenceEqual(array1, array2); } } }