条件 C# 断点? [英] Conditional C# breakpoint?

查看:30
本文介绍了条件 C# 断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试一个 foreach 循环,它将迭代超过 1000 次 - 所以我只希望循环中的一个断点为特定项目中断.

I'm debugging a foreach loop which will iterate well over 1000 times - so I only want a breakpoint within the loop to break for a particular item.

所以...

foreach(Employee employee in employees)
{
//DO SOMETHING
//BREAK HERE WHEN employee.Id == '2342'
//DO SOMETHING ELSE
}

我是否必须在其中编写一个 If 语句和一些虚拟代码并以这种方式破坏它?只有这样吗?

Do I have to write an If statement and some dummy code within it and break it that way? That the only way?

推荐答案

只是添加到以前的答案.使用条件断点.

Just adding to the previous answers. Use Conditional Breakpoints.

您可以指定如下条件

You can specify the condition like below

这篇关于条件 C# 断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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