什么时候调用属性?

2023-12-20

我对某些代码感到困惑。

在班级中我有一个财产

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。我是否遗漏了一些属性?

EDIT: 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, enter image description here

我的屏幕截图

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


通常,调试器配置为单步执行属性,因此您的断点永远不会被“命中”。确保未选中以下复选框:

Tools => Options => Debugging => General => Step over properties and operators
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

什么时候调用属性? 的相关文章

随机推荐