Why does .Dump(#) cause my results to double?
When I run an OData query with LinqPad, I sometimes need more than the standard 3 levels of nesting/expanding.
I found online that y开发者_运维百科ou 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:
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.
精彩评论