53

I'm debugging some tricky generic List-based code in VS 2010 - lots of hierarchy-processing etc.. Of course lambda expressions and anonymous methods aren't permitted within the immediates window and I can't be doing with stepping thru the code in the usual way as I'm still trying to get my head around the hierarchies ...

Can anyone suggest a workaround or an alternative tool?

Alex
  • 21,273
  • 10
  • 61
  • 73
immutabl
  • 6,857
  • 13
  • 45
  • 76

1 Answers1

16

At times like this I always turn to the most excellent LINQPad.

The front page of the linked site (at time of writing) immediately jumps in with stuff about SQL but don't let that obscure how powerful and flexible this tool really is. I sort of treat it like an Immediate Window on steroids. I find it invaluable for working my way through complex LINQ queries.

If you can live without intellisense it's free (the intellisense version is chargeable).

Holf
  • 5,605
  • 3
  • 42
  • 63
  • 2
    I use it pretty much everyday. It is an amazing tool. Actually, 'tool' doesn't do it justice. – immutabl Dec 07 '12 at 21:11
  • 1
    I have to agree that for many cases, LINQPad is a good workaround. – Wallace Kelly Dec 13 '12 at 14:02
  • 4
    I understand this is good for snippets, but what if you are at a breakpoint and want code to run in that context? Is there away to attach LINQPad to the current debug context to use as an immediate window? – AaronLS Mar 31 '14 at 23:05
  • Yeah, I have the same question as @AaronLS – Christofer Ohlsson Aug 01 '14 at 09:13
  • 1
    Do you have to be hooked up a database? or can I mock data by defining an array or something? – C. Tewalt Aug 13 '14 at 15:02
  • ....What if I just want to use LINQ on code and not a database? – Brandon Aug 27 '14 at 15:51
  • 1
    You don't have to be hooked up to a database. You don't even have to be using linq, despite the product name. It's just an excellent general sketchpad for.net code. – Holf Aug 28 '14 at 06:50
  • @Brandon - you can user your own data access assembly with Linqpad - just add it as an additional reference (in Linqpad: Query > Properties ...) – immutabl Sep 01 '14 at 12:30