Filter Util.Dif to only non-matched properties
First, I love the new Dif method in 5.25. I see that as well as comparing the same types, you can also compare objects of different types which is great.
One question though, is, is there an easy way to filter the dump output to just show the non-matching properties?
Many thanks,
John
One question though, is, is there an easy way to filter the dump output to just show the non-matching properties?
Many thanks,
John
Comments
https://www.linqpad.net/download.aspx#beta
One more question - does this work with the exclude parameter in Dump? I'm finding the following doesn't exclude the named properties, but maybe this is the result object rather than the underlying one?
void Main()
{
var one = new One() {
A="alan",
B="bob",
C="charles",
D="david",
E="ed"
};
var two = new Two()
{
A = "andy",
C = "cyril",
E = "ed"
};
Util.Dif(one, two, hideMatchingMembers: true).Dump(exclude: "B");
Util.Dif(one, two, hideMatchingMembers: true).Dump(exclude: "C");
}
public class One
{
public string A { get; set; }
public string B { get; set; }
public string C { get; set; }
public string D { get; set; }
public string E { get; set; }
}
public class Two
{
public string A { get; set; }
public string C { get; set; }
public string E { get; set; }
}
I'm still haven't discovered a good way to exclude members from the dif result. If I save the Dif output to a var I can see the List in the Members property of the MemberDifNode, but I guess they're private at the moment?
Util.Dif (Util.ToExpando (one, exclude:"B"), Util.ToExpando (two, exclude:"B"), hideMatchingMembers: true).Dump ();