什么时候一个属性被调用? [英] When does a property get called?

查看:202
本文介绍了什么时候一个属性被调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码混淆。

里面的类我有一个属性。

Inside a class I have a property

Class A
{
  ClassB objB;

  public int TimedValue
  {
    objB.Timer;
  }
}

Inside classB I have

classB
{
 public int Timer
 {
  get
  {
   // get time value using some algorithm....
  }
 }
}

我的困惑是,我把里面的干将断点,但我没有看到该程序流程那里停下来!虽然我看到被创建和充分的TimedValue填充,当我看着它在调试模式下手表窗口内的对象。我缺少的东西的属性。

My confusion is that I place breakpoints inside the getters, but I dont see the program flow there and stop! Although I see an object being created and full populated with the TimedValue when I look at it in debug mode inside a watch window. Am I missing something on properties?

编辑:那么,引导啉我穿过正确的步骤,但我找不到选项那里。下面是截图它被设在哪里是,

So, ColinE guided me through the right steps, except I could not find the option there. Here is the screen shot where of where it was suppose to be,

我的屏幕截图


我想这是一个错误VS。反正只是张贴这使任何人与团队系统2008年应该记住这一点:)

I guess this is a VS bug. Anyway Just posted this so that anyone with team system 2008 should make a note of this :)

推荐答案

通常情况下,调试器配置到跨过特性,使你的断点将永远不会被'打。确保以下复选框未被选中:

Typically the debugger is configures to step over properties, so your breakpoint will never be 'hit. Ensure that the following checkbox is not checked:

Tools => Options => Debugging => General => Step over properties and operators

这篇关于什么时候一个属性被调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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