In C #, How to get the value of a variable when it changes Without threads or timers

int i = 0;

When changing the value of 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

+7
c #
source share
1 answer

Use property:

 private int _i = 0; public int i { get { return _i; } set { if (_i == value) { return; } _i = value; callback(value); } } 
+11
source share

All Articles