How to receive comparison result (true, false) in .NET

I need to get info about comparison result, if documents are equals => true, if the are not equals => false.

current code is:

     >    using (Comparer comparer = new Comparer(source1))
       {
           comparer.Add(target1);
            comparer.Compare(res1);

       }
1 Like

@nikitozegg

Please have a look at the code below:

using (Comparer comparer = new Comparer(@"D:/1.docx"))
{
        comparer.Add(@"D:/2.docx");
        comparer.Compare(@"D:/result.docx");
        ChangeInfo[] changes = comparer.GetChanges();
}

If there’s any difference, you will get the changes count. Otherwise, it’ll give you 0. Have a look at this documentation article.