Thread: C# основной форум/Compare two files

Compare two files
string fileA, fileB, fileC;
var result = File.ReadAllLines(fileB).Except(File.ReadAllLines(fileA));
File.WriteAllLines(fileC, result);

source







Re: Compare two files
Removes all instances in FileA from FileB by outputting them in FileC

private static void CompareFiles()
{   
File.WriteAllLines("FileC.txt",    File.ReadAllLines("FileB.txt").Except(File.ReadAllLines("FileA.txt")                                        .Union(File.ReadAllLines("FileD.txt"))));
}



Re: Compare two files
  • A Generic, Reusable Diff Algorithm on codeproject
  • An O(ND) Difference Algorithm for C#
  • Diff/Merge/Patch Library for C#/.NET by Joshua Tauberer