How to most efficiently detect a changed variable and then act on it?

I have a class of static variables called GlobalVars in which I track… “global” variables.

Next I have GameController, BankManager and other classes…

Some actions in my game set variables in GlobalVars. I would like BankManger to be “notified” when particular vars change, so that some UI display will be updated accordingly.

Yes, I am describing something usually called Data Binding, but I don’t think I want to implement a full data binding solution. Is there an efficient way that a change of a variable could be detected, so that I then call the BankManager class to do its thing? All I can think of at the moment is using Update() in GlobalVars and have a list of duplicate variables so I can compare VAR1 == last_VAR1 but this seems terribly inefficient to compare every variable every frame update.

C#

I don’t know anything about data binding, but I know the observer design patter.
what you can do, for each variable, create an event and a property. whenever the property’s setter changes your variable also for the event. the BankManager can subscribe to that event and get notified on a change.