Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does a property get called?

Tags:

c#

properties

I have a confusion on some piece of code.

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....
  }
 }
}

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?

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

My screen shot

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 :)


1 Answers

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
like image 79
ColinE Avatar answered Nov 21 '25 12:11

ColinE