views:

35

answers:

3

Hello,

I would like to compare two versions of a class. I have used WinDiff, but it shows a lot of differences because of different commenting etc.

Does anyone know of a tool to compare two class definitions (fields, methods etc.) for .NET?

Thanks,

Martin

+2  A: 

You could use WinMerge, which works in principle like WinDiff, but you can define line filters describing the things you want to be ignored (like comments).

To compare classes by their structure, you can compile both, use Lutz Roeder's reflector to decompile them and then compare the result with WinDiff or WinMerge.

Doc Brown
+1  A: 

If you want to compare the source code, then using a pretty formatter (e.g. the one in VS) to normalise formatting, you will still need to handle ordering of members and comments etc.

Better might be to use Reflector on compiled assemblies. Select each class, expand its methods (if you want to include the method implementation in the comparison), copy and paste into a text file, and then compare the text files.

This should eliminate all non-significant (i.e. not in the assembly) details.

(Note, there might be a Reflector plugin to do this directly.)

Richard
A: 

Our Smart Differencer compares two programming langauge source files in terms of language structures, not text layout, so it will ignore comments and whitespace changes.

There are versions for many languages, including C#, but not VB.net.

Ira Baxter