Show dif names when diffing lists
Hi,
Is there an easy way to include the dif names when diffing two lists as opposed to two single objects?
For example this code:
void Main() { var a = new House(1, 3); var b = new House(2, 3); Util.Dif(a, b).Dump(); var firstList = new List<House>() { new House(1, 3), new House(2, 3) }; var secondList = new List<House>() { new House(3, 3), new House(4, 3) }; Util.Dif(firstList, secondList).Dump(); } public class House(int number, int roomCount) { public int Number => number; public int RoomCount => roomCount; public override string ToString() { return $"House {Number}"; } }
...produces this output:
It would be great to be able to see some dif names in the second dump. Maybe as additional Util.Dif string parameters?
Best regards
John
Comments
So my current workaround is this:
... which results in this output:
I don't love the mixing of the Diffing and Dump, but it's nice and compact at least:)
If the purpose is just to remind yourself which list is which, then I'd just use
Util.Dif(firstList, secondList).DumpTell();
or you can set Enable automatic Dump-headings by default for new queries and just dump as per normal.
Hi, I'd forgotten about DumpTell. I think I still want the colours to be reflected as I want the the most clear link between the labels and the data. DumpTell is cetrtainly quicker though