的DebugBreak()相当于在C# [英] DebugBreak() Equivalent in C#

查看:131
本文介绍了的DebugBreak()相当于在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#中有相当于的DebugBreak的陈述()。我想调用调试器当过特定条件得到满足。

In C# is there any statement equivalent to DebugBreak(). I want to invoke the debugger when ever a particular condition is met.

请帮忙

推荐答案

您可以使用的打破调试类的方法,在System.Diagnostics命名空间:

You can use the Break method of the Debugger class, in the System.Diagnostics namespace:

Debugger.Break();

现在,还有一个不同的方式,您可以添加条件断点,无需摆弄增加code到项目中。

Now, there's also a different way you can add conditional breakpoints, without mucking about with adding code to your project.

这当然只有当已通过调试器中运行程序的工作原理

你可以做的是先加一个普通断点,你希望你的调试器停止的位置,然后用鼠标右键单击红点断点:

What you can do is first add a regular breakpoint at the location where you want your debugger to stop, then right-click the red dot for the breakpoint:

,然后编辑条件,以满足您的需要:

and then edit the condition to fit your needs:

这将被符号化的小+断点点内:

This will then be symbolized with a small + inside your breakpoint dot:

这篇关于的DebugBreak()相当于在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆