Does anyone know of a tool or library in .net that can be used to compare object properties and sub-objects like beyond compare does for text files? What I am looking for is a way to show two instances of the same type and show colored coded differences between them and allow the user to copy values between the objects.
+1
A:
Just an idea: serialize your objects into XML and run a WinDiff or TortoiseSVN built-in diff-viewer.
The export can be done (with [Serializalbe] objects) with XmlSerializer or DataContractSerializer:
Person p1 = new Person("Zighetti", "Barbara", 101); FileStream writer = new FileStream(fileName, FileMode.Create); DataContractSerializer ser = new DataContractSerializer(typeof(Person)); ser.WriteObject(writer, p1); writer.Close();
Repeat this step for p2 (instance of Person).
Drop your xmls into WinDiff or your favorite diff viewer.
Special XML diff tools
boj
2009-04-07 21:22:30
Yes, serialize it, but serialize to an XmlWriter configured to do indentation. You might also need to do postprocessing to maintain a canonical order.
John Saunders
2009-04-07 21:29:20