If you have a BindingList<Person> for example and you bind it to a control, if your Person class doesn't implement INotfiyPropertyChanging / Changed, your changes to the underlying List won't show up in your control automatically. My question is, are there any other uses for these interfaces as far as the framework is concerned? I'm not talking about using these interfaces to implement your own actions based on these events, I'm talking about in the .NET Framework itself, is there ever another need to implement these interfaces?
views:
362answers:
1I can't speak with 100% confidence, but since you didn't have any other answers and I was interested myself I've just fired up Reflector and checked which classes have a dependency on INotifyPropertyChanged, and the short answer appears to be: No, it isn't really used for anything else.
Looking through the classes, some of the non-databinding references are:
System.Configuration.ApplicationSettingsBase - so if you decide to implement your own provider for application settings then it should expose INPC functionality. So there is one area where it is used outside of DataBinding, but a very narrow niche.
System.Printing.PrintTicket also implements INPC. I haven't done a great deal of printing through .NET, so this may be important, it may not. I really couldn't say.
So, to answer the question more fully: If you aren't databinding I doubt you'll find any benefit to making your classes implement INotifyPropertyChanged, there are a few edge cases where the interface is used outside of a DataBinding context, but if you were working in those areas you'll quickly find that out for yourself.