DebugBreak()等价于C#

编程入门 行业动态 更新时间:2024-10-24 20:12:05
本文介绍了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.

请帮助

推荐答案

您可以使用 Break 方法的 Debugger 类,在System.Diagnostics命名空间中:

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

Debugger.Break();

现在,还有一种不同的方法可以添加条件断点,而不用添加代码到你的项目。

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#

本文发布于:2023-11-09 15:36:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572750.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:DebugBreak

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!