Dump object graph with (depth:1, alpha:false) into DumpContainer

Basically I have a complex nested model object that I want to dump out as-is, and use the collapsible header to explore. However the object is really heavy with about 5 levels of nesting, so I must dump it as depth:1, and ideally alpha:false as well because I'm converting it to an ExpandoObject and controlling the sort order myself.

If I do myModel.Dump(depth:1, alpha:false) it works perfectly. But as I do fresh dumps they accumulate to the bottom of my output window. I'd like to put it in a specific spot in my output GUI and replace it on click of a button.

If I try to put it in a DumpContainer instead, using something like:

packetContainer.Content = Util.RawHtml(Util.ToHtmlString(true, 1, myModel)));
packetContainer.Refresh();

It does indeed put it in the container, but the headers are not clickable, and I don't seem to have an option to control alpha:false either.

Is there a way to accomplish this?

Best Answer

  • JoeAlbahari
    edited March 3 Answer ✓

    Have you tried this:

    var dc = new DumpContainer().Dump(depth:1, alpha:false);
    dc.Content = myModel;
    

    DumpContainer also has a DumpDepth property, so another option is to do this:

    var dc = new DumpContainer().Dump(alpha:false);
    dc.DumpDepth = 2;
    dc.Content = myModel;
    

Answers