int i = 0;
When changing the value of i :
i
i = (Atypical value)
then
bool callback(int i) target = i; return true;
In C #, How to get the value of a variable when it changes Without using threads or timers
Use property:
private int _i = 0; public int i { get { return _i; } set { if (_i == value) { return; } _i = value; callback(value); } }