Search code examples
c#file-comparison

C# file comparison utility


Can you recommend a good file comparison utility that is able to handle C# very well. I have tried both WinMerge, BeyondCompare and KDiff and they are not good enough, e.g. if I have functions with the same name but placed in different areas of the file they show it as differences.


Solution

  • [Update (2015): Since writing this answer there are now more modern tools that can do structural and semantic merging and diffing of code in various languages. See JotaBe's answer for some examples]

    Original answer (2010): Unfortunately, that is kind of the nature of Diff. It's always been a line by line comparison, it's not a language aware comparison. As far as I am aware there is nothing that does what you are asking for (It's always possible I'm wrong though).

    You could use a tool like regionerate to standardize class layout before you do the comparison. This would order all your methods, so you wouldn't have the problem with a method of the same name being in different places in a file.