I'm using the following method to compare 2 files:
static bool comparatabelas(string path1, string path2)
{
byte[] file1 = File.ReadAllBytes(path1);
byte[] file2 = File.ReadAllBytes(path2);
if (file1.Length == file2.Length) //só verifica comprimento
{
//comando for adicionado ao original, com este dava sempre falso
for (int i = 0; i < file1.Length; i++)
{
if (file1[i] != file2[i])
{
return false;
}
}
return true;
}
return false;
}
Comparing the files by iterating over every character in each of them works, and I have tried it several times:
for (int i = 0; i < file1.Length; i++)
{
if (file1[i] != file2[i])
{
return false;
}
}
return true;
However, if I use this particular piece of code it will give the result that the files are different even though they have the exact same content. I even tried to save the 2nd file in another folder but with the same name; however, I still got the result that they were different. Any advice on how I can fix this problem?
UPDATE:
I was saving tabledata's via xmlwrite, happens that when i was comparing, they had different table names, never tought it could be that, nevermind.