Hi,
In reading about the Observer design pattern, I noticed that it is implemented using interfaces. In Java, the java.util.observable implementation is also a class. Shouldn't the C# and Java versions use interfaces ?
Scott
Hi,
In reading about the Observer design pattern, I noticed that it is implemented using interfaces. In Java, the java.util.observable implementation is also a class. Shouldn't the C# and Java versions use interfaces ?
Scott
But they DO use interfaces. The ObservableCollection in .NET is an implementation of the interfaces - you are free to ignore it and to your own implementation.
Well, it implements INotifyCollectionChanged and INotifyPropertyChanged. However, interestingly, it doesn't implement the new IObservable<T> interface from .NET 4.0, which you might have expected.
It would arguably be useful for there to be a generic form of INotifyCollectionChanged... but I don't know of one.