我如何:创建一个断点使用条件? [C#快递] [英] How Do I: Create a Breakpoint Using Conditions? [C# Express]

查看:344
本文介绍了我如何:创建一个断点使用条件? [C#快递]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Visual C#2008 RSS订阅已经看到了这个永远的现在:

I've been seeing this in my Visual C# 2008 RSS Feed forever now:

我敢肯定这是VS 2010只配备了,但我想知道是否有无论如何在VS 2008中复制呢?

I'm pretty sure this is a VS 2010 only feature, but I was wondering if there is anyway to replicate this in VS 2008?

推荐答案

类似@Relster我有一个代码段有以下

Similar to @Relster I have a code snippet with the following

#if DEBUG
    if( node.Name == "Book" )
        System.Diagnostics.Debugger.Break();
#endif



其中, node.Name ==书 基础上我想测试的病情变化。在#如果DEBUG 包装确保了检查从未使其发行代码。

Where node.Name == "Book" changes based on the condition I want to test for. the #if DEBUG wrapper makes sure the checks never make it to release code.

这也是的很多的比在Visual Studio中使用条件断点更快。当您使用内置的条件bp的视觉工作室已经打入应用程序,暂停所有线程,计算表达式,并确定它是否是真的每次它击中断点时间。在紧密循环这可能是接近充分执行性能,并在爬行运行之间的差异。

This is also a lot faster than using the conditional breakpoints in Visual Studio. When you use the built in conditional bp visual studio has to break into the app, pause all the threads, evaluate the expression and determine if it is true each time it hits the breakpoint. In a tight loop this can be the difference between near full execution performance and running at a crawl.

这篇关于我如何:创建一个断点使用条件? [C#快递]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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