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,



  • Good call - I'll add an option for this in the next build.
  • Great! It gets better and better :)
  • Very nice! Thank you. I like the way when comparing different types the shared properties are sorted to the top and the filtering really helps see the wood for trees:
  • Hello Joe,

    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() {

    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; }
  • Can I bump this question?

    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?
  • You could try this:

    Util.Dif (Util.ToExpando (one, exclude:"B"), Util.ToExpando (two, exclude:"B"), hideMatchingMembers: true).Dump ();
  • Ah, perfect. I hadn't considered filtering the inputs. Thanks very much Joe.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!