我该如何与QUOT;运行到这个变量变更];调试时? [英] How do I "run until this variable changes" when debugging?

查看:98
本文介绍了我该如何与QUOT;运行到这个变量变更];调试时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调试我的C#,我常常想知道的当一个变量的值的变化,然后调查程序的状态。

When debugging my C#, I often want to know when a variable's value changes and then investigate the state of the program.

目前,我这样做是这样的:

Currently, I do it like this:


  1. 观察名单违规变量。

  2. 物理垃圾F10 (快捷键步过),直到我看到了价值变动。

  1. Watch-list the offending variable.
  2. Physically spam F10 (shortcut for Step Over) until I see the value change.

不过,F10s所需的数量是烦人。

However, the number of F10s required is annoying.

当然,这已经自动化,我想。但我不能找到我的微软的Visual C#速成此功能的,这令我感到奇怪。毕竟,观察名单的确实的自动突出显示在鲜红的改变值。

Surely this has been automated, I thought. But I cannot find this feature in my Microsoft Visual C# Express, which surprises me. After all, the Watch-list does automatically highlight changed values in bright red.

我缺少的东西吗?

推荐答案

有关Express版本简单的一招:

Simple trick for Express edition:

private string myValue;
public string MyValue
{
  set
  {
    if (this.myValue != value) Debugger.Break();
    this.myValue = value;
  }
}

这篇关于我该如何与QUOT;运行到这个变量变更];调试时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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