I just want to debug calling Find from Immediate Window, is it possible?
Customer found = listOfCustomers.Find(
delegate(Customer cu)
{
return cu.Name.ToLower().Contains("adam");
}
);
As pointed out by many others, you cannot use the immediate window to do this. I do have another suggestion that might work well for you. I use it all the time and it is the best tool I’ve used in a long time.
Roslyn is a project from Microsoft that exposes the C# and VB.NET compilers to developers. That is cool for a number of other reasons, but one in particular pertains to your needs. It includes a C# Interactive Window.
While it is a CTP (hasn’t even made a beta release yet), I’ve found it to be quite stable. The June 2012 CTP supports VS2010, while the September 2012 CTP supports only VS2012.
You can reference other DLLs (both system and project) using the
#rdirective, and then use normal C# code and plug away. It supports nearly all of the language features (I think async/await, PInvoke, dynamic, and a few other things aren’t). Here’s a sample of it’s output.As you can see, you can use lambdas (you can use anonymous methods as well) as well as other language features. I also referenced the Lucene.Net dll that’s on my computer, and then was able to import the namespace and use the types. You can also reference an entire project my right-clicking on it and selecting “Reset Interactive from Project”, but I’ve found that it sometimes will throw an error and not work.
If you’re looking for a tool to play around with code without having to run the debugger, I would recommend looking into Roslyn.