- Create a breakpoint (f9) around the variable
- Right-click on the red circle of the breakpoint and click on "Condition..."
- Type in the name of the variable, and change the radio to "Has changed"
- The breakpoint should now have a
+
in it to indicate that it is conditional
However: frankly, I find the following simpler and much more efficient - especially for fields; say we start with:
string name;
we change it just for now to:
private string __name;
string name {
get { return __name; }
set { __name = value; }
}
and just put a break-point on the set
line. It should still compile, and you can see the change trivially. For more complex cases:
private string __name;
string name {
get { return __name; }
set {
if(__name != value) {
__name = value; // a non-trivial change
}
}
}
and put the breakpoint on the inner-most line; this bypasses code that sets the field without actually changing the value.