在某些特定条件下停止执行 [英] stop executio at some particular condition
本文介绍了在某些特定条件下停止执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的,
我想知道是否可以在某些特定的变量值处中断执行.
我正在使用C#.net
谢谢您
Hi Dears,
I want to know if I can break the execution at some particular values of variables.
I am using C#.net
thank you
推荐答案
根据您拥有的Visual Studio的版本/版本,您可以使用
Depending on the version/edition of Visual Studio you have, you can use conditional breakpoints.
If you don''t have the correct version/edition, you can just use an if statement and put a breakpoint in that:
int x = GetValue()
if(x == 5){
// Set breakpoint on the below line.
x = x;
}
执行此操作的最佳方法是使变量成为属性,以便您可以添加代码以检查该值并在其中放置断点.您可以将断点设置为仅基于一个值触发,但它们仍将仅在该断点上触发.
The best way to do this, is make your variable a property, so you can add code to check for the value, and put a breakpoint in there. You can set breakpoints to only trigger based on a value, but they will only trigger on that breakpoint still.
这篇关于在某些特定条件下停止执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文