Sometimes you want a quick way to start stepping through some code that you suspect has an error.
Depending on where the code lives simply getting to it can be a pain. A function in a service that depends on a bunch of other libraries can be non-trivial to execute in an isolated context. The 20mins or so of setup, over time, starts to add up.
In a web or client-server context getting to the code of interest may be even more convoluted. It may require a client to step through several pages before triggering the request that results in execution of the code. Put that code inside a web service and oy, we’re talking 20-30mins just to start stepping through a function.
Visual Studio’s immediate mode can execute functions in the context of the current project. CTRL+D,W to open up the Immediate window then ?int temp=SomeStaticFunc(3);
results in the value of temp being printed out. If the function isn’t static you’ll need to have some other function that creates the desired instance (let’s call it p). Then in the Immediate window ?int temp=p.SomeInstanceMethod(3); does the trick.
Of course there are other ways to accomplish the same result but Immediate mode is another tool in the toolset for quickly getting into a function of interest.