16

Couldn't find it anywhere (google or stackoverflow).

Is there a way to force Dump()'s output to be automatically collapsed?

Update:

Some more info, to bring more focus to the question.
As mentioned below Collapsing can be done after the output as rendered via keyboard shortcust (Alt+1, Alt+2, Alt+3) And can rendering depth can be determined by passing an int depth param, but that does not allow to expand the results.

Is there some way to change the CSS formatting? I'm not that fluent in CSS, so this might be the solution.

Why I need this:

What I want is to make the output 'cleaner', and dive in when something of interest show's up. I'm running a query repeatedly, and don't need all of the output all the time, but still using my human abilities to detect change, instead of coding the detection.

Update: November 2013

As Joe (the author himself!) mentions in the comments, LINQPad no longer has the limitation described. It is now possible to state 0 and collapse the information after it's rendered.

Lockszmith
  • 2,173
  • 1
  • 29
  • 43
  • Update: the newer versions of LINQPad let you to expand the results infinitely after execution, even if you call Dump with an integer to limit the initial rendering depth. – Joe Albahari Nov 12 '13 at 01:43

1 Answers1

33

No, although you can call Dump with a number to force it to display to that nesting depth:

.Dump(0)

You can also use the formatting shortcuts (Alt+1, Alt+2, Alt+3) to collapse the whole display to one, two or three levels.

Another option is to dump to grids. Call Dump(true) or use the toolbar button. Grids show only one level and subsequent levels are shown upon demand with hyperlinks.

Joe Albahari
  • 30,118
  • 7
  • 80
  • 91
  • Thanks for the keyboard shortcut tips, and grid, though we're still to one level, I'd like to have it completely collapsed. I already know about the depth parameter, but that does not allow later expansion. I'll keep the question open for a bit longer. – Lockszmith Apr 22 '12 at 09:42
  • 5
    +1 The Alt-1,Alt-2 etc is exactly what I needed. Especially when doing demos of object models. It is nice to, for example, dump 5 levels deep, but collapse to 2 quickly. The queries for demos are usually ad hoc and it's not hard to design them so that all dumps within them are easy to navigate at one specific level (often Alt-2). Huge win. – Tormod Aug 08 '12 at 09:32
  • 1
    Is there any way of preserving the Collapse/Expand state when exporting to html? I see that they are expandable/collapseable in external browser, but exported html start out as expanded when openend in browser. – Tormod Aug 08 '12 at 09:37
  • 1
    I've been using LINQpad for about 3 years now, bought the license and recently the upgrade, and just noticed that I was so clueless to acknowledge this answer came from the master himself, the author of LINQPad. He is the reason LINQPad is so awesome, and his support and prompt response to any feedback out there is amazing. Thank you @Joe! – Lockszmith Oct 28 '15 at 21:39
  • Is there a reason Alt-1 and `.Dump(1)` don't produce the same result? I would like `.Dump(0.5)` :) – NetMage Mar 22 '19 at 19:08
  • @NetMage Alt-1 collapses the grid already on the screen to one level. `.Dump(1)` prevents the grid from being created with more than one level; further levels are hyperlinks. – Ross Presser Mar 25 '22 at 18:53
  • @RossPresser But `.Dump(1)` still shows the first level of hyperlinks expanded. Alt-1 collapses the grid to 0 levels. – NetMage Mar 25 '22 at 19:57
  • @RossPresser Also, it would really be nice to have a `Dump` parameter to collapse instead of having hyperlinks. – NetMage Mar 25 '22 at 20:04
  • 1
    @RossPresser - try this overload: Dump(int depth, int? collapseTo) – Joe Albahari Mar 27 '22 at 01:08
  • @JoeAlbahari Is that new for LinqPad 6? My company did buy the upgrade from 5 to 6, but I'm still using 5, and that overload isn't there. – Ross Presser Mar 27 '22 at 18:01