I need to implement an event to notify when a property has changed.
Method 1.
If I use a generic PropertyChanged event from System.ComponentModel then it
will be raised for every property if 1 or more properties changed events are
consumed. (more overhead, less coding)
i.e
PropertyChanged(object sender, PropertyChangedEventArgs e);
Method 2.
If I implement a PropertyNameChanged event then I have to have a delegate
and event for every property but it will only be raised if consumed on a 1
by 1 basis. (less overhead, more coding) (would not be hard to write an
addin to generate code for this).
i.e.
Property1Changed(object sender, EventArgs e)
or
Property1Changed()
If I use method 1 (which I am leaning towards at the moment) then I would be
inclined to add a string constant to the class for each property simply to
indicate the property name so I can use a switch in the consuming class to
determine which property changed and avoid typos when typing property names.
What have others done in this situation?
Cheers
JB