I want to know, is there any way in Visual Studio 2008 to set a value breakpoint kind of a thing ? Like say there’s a variable called ‘test’, and I want to the code to stop at any line in the entire project where the value of this variable is being changed .. ?
That is, I don’t want any line specific breakpoint .. I just want Visual Studio to stop at the line of code where a change is being made to some variable ..
The code I have is very complex and it would be a lot easier for me to debug the code if I can get the mentioned functionality somehow ..
You should encapsulate the variable in a property so the field named
testbecomes_testormTestor whatever and you create a new property called test that other code will use. You can put the breakpoint on the setter of the property.So instead of having
You can have
And there’s no need to alter any of the users of
test, unless they’ve already been compiled in which case you’ll need to compile them again.