What’s the easiest way to find out if two text files are different programmatically? Given two files I just need to know whether they are different or not. This is for a quick tool to help with a particularly nasty merge (switched languages from VB to C# in one branch (yay!) and made many changes in the other), it won’t be going into production.
Possible solutions:
- Hash both files and compare the hash
- Pull the files in and just do a string compare
- Call out to an external diff tool (unfortunately Winmerge doesn’t have a CLI for this)
If possible ignoring white space would be awesome but I don’t care that much about it. The main thing is this it needs to be quick and easy.
I’m using .Net 3.5sp1 by the way. Thanks for any ideas or pointers.
There is an article in the Microsoft Knowledge Base, hope it helps. They compare the bytes to see whether two files are different – How to create a File-Compare function in Visual C#