Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does .Dump(#) cause my results to double?

Tags:

linqpad

When I run an OData query with LinqPad, I sometimes need more than the standard 3 levels of nesting/expanding.

I found online that you can call Dump(int nestingLevel) to get more levels of nesting.

But when I do that I get two result sets. (One with my expanded nesting, and one as it would be without the .Dump call.)

Why is that? Is there a way I can turn that off?

As an example connect to https://data.stackexchange.com/stackoverflow/atom and run this query:

Posts.Take(1).Select(x=>new{x.Title}).Dump(1)

You will get two identical result sets. Like this:

LinqPad Double

like image 923
Vaccano Avatar asked Oct 03 '11 15:10

Vaccano


People also ask

What does Do not dump mean?

Informal. to end a relationship with (someone, especially a romantic partner), especially when the decision is one-sided: I can't believe she waited until just after Valentine's Day to dump me. to transfer or rid oneself of suddenly and irresponsibly: Don't dump your troubles on me!

What does dump mean slang?

(vulgar, slang, often with the verb "take", euphemistic) An act of defecation; a defecating. I have to take a dump.

How do you use the word dump?

Definition of dump 1a : to let (something) fall in or as if in a heap or mass He dumped his clothes on the bed. She dumped the contents of her purse on the table. also : to empty (a bag, box, etc.) so that its contents fall in or as if in a heap or mass She dumped her suitcase on the bed.

What are the effects of dumping?

Dumping enables consumers in the importing country to obtain access to goods at an affordable price. However, it can also destroy the local market of the importing country, which can result in layoffs and the closure of businesses. The WTO and EU regulate dumping by putting tariffs and taxes on trading partners.


1 Answers

When you run a C# Expression query, the query's result is automatically dumped.

LINQPad compiles the code

LINQPad.Dump(
    //Your code here
);

Your code calls Dump() too, so you're dumping the object before returning to the outer generated Dump() call.
(Dump() returns its argument to allow chaining)

You only need to Dump() in a C# Statements (or higher) query, or if you want to dump something else.

like image 114
SLaks Avatar answered Oct 11 '22 05:10

SLaks