Getting a Method's Return Value in the VS Debugger

前端 未结 8 1701
迷失自我
迷失自我 2020-12-15 19:46

Is it possible to get a method\'s return value in the Visual Studio debugger, even if that value isn\'t assigned to a local variable? For example, I\'m debugging the follow

相关标签:
8条回答
  • 2020-12-15 20:18

    You can set a breakpoint in Foo, open the immediate window and run the following command:

    ? Foo(valueIn)
    

    This will print the return value in the Immediate Window.

    You can also copy the expression and paste it into the Watch window, though I would do this only if I am certain that the call has no side effects (otherwise you can get confusing results).

    0 讨论(0)
  • 2020-12-15 20:29

    You can always use your watch box to evaluate function calls.

    Foo(valueIn);

    This will only work if your Proxy.Bar(valueIn) is time independent though.

    0 讨论(0)
提交回复
热议问题