Mega Code Archive

 
Categories / C# / File Stream
 

Bytes Equal

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing; using System.IO; using System.Runtime.Serialization.Formatters.Binary; namespace AltSerializer.Tests {     public static class Common     {         public static bool BytesEqual(byte[] bytes1, byte[] bytes2)         {             if (bytes1 == null && bytes2 != null)                 return false;             else if (bytes2 == null && bytes1 != null)                 return false;             else if (bytes1 == null && bytes2 == null)                 return true;             else if (bytes1.Length != bytes2.Length)                 return false;             else             {                 for (int i = 0; i < bytes1.Length; i++)                 {                     if (bytes1[i] != bytes2[i])                         return false;                 }             }             return true;         }     } }