0

I am playing around with LinqPad4. This is my SQL Statement that returns 2 records, my equivalent Linq statement executed successfully, however it does not show any results.

select top 2 * from Nums


var testing = (from nums in Nums select new {nums.N}).Take(50);

enter image description here

enter image description here

Why??

Thanks & Regards,

June
  • 974
  • 5
  • 20
  • 34

2 Answers2

1

You assigned the result of the query to the variable testing. If you want to see the contents in the results pane, you can dump it like this.

testing.Dump();

You could also switch the language to C# expression, and ditch the variable declaration entirely.

recursive
  • 83,943
  • 34
  • 151
  • 241
1

Dump() outputs your result to the output window.

So it is either:

var testing = (from nums in Nums select new {nums.N}).Take(50).Dump();
// or
testing.Dump();

Joe Albahari (the author of LinqPad) has also written an article about both output methods Dump() and Dissamble() here: LINQPad [extension] methods.

Community
  • 1
  • 1
Marco
  • 22,856
  • 9
  • 75
  • 124