c# - How to keep observing the dictionary? -
i have dictionary :
public dictionary<string, string> fields { { } set { } }
how can fire event keep listening dictionary? , changed in event event handler should called. possible without making dictionary observable?
private int _age; public event system.eventhandler agechanged; protected virtual void onagechanged() { if (agechanged != null) agechanged(this,eventargs.empty); } public int age { { return _age; } set { _age=value; onagechanged(); } }
i don't want above implementation.
you'll need custom class. wrap dictionary in class , create event track when dictionary changes. need override existing add / remove etc , when called, have them raise event.
here's question may help. .net observabledictionary
Comments
Post a Comment