我有一行这样的代码
return foo(barIn);
如果我在该行上放置一个断点,我可以检查 foo(barIn) 的返回值而不单步执行 foo 吗?我可以将代码重写为
var result = foo(barIn);
return result;
但我想要不重写也不放弃当前代码的便利。
========== 编辑 ==========
四个最初的答案很有趣(谢谢),但它们实际上并没有回答我的问题。让我试着说得更清楚一些。
在这个方法中
public string functionA()
{
return functionB();
}
Visual Studio 2012 中有没有办法在“return functionB();”行上放置断点并检查 functionB 的返回值而不单步执行 functionB、重新运行 functionB 或重写 functionA?
不,您无法满足这种确切的行为。看在Visual Studio中调试时,我可以在返回之前找出返回值吗 https://stackoverflow.com/questions/268048/can-i-find-out-the-return-value-before-returning-while-debugging-in-visual-studi。您可以获得的最接近的是:
If foo
是幂等的(即它没有任何副作用),那么你可以添加一个监视foo(barIn)
.
If it does have side-effects, then put your breakpoint on the return
, and then step-out (Shift+F11 by default) of the function and inspect the variable that the result of the function is assigned to.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)