If your collection property is read-only, you don't need to notify anything that the entire collection has changed to a different one - instead, the event handlers on the collection will be notified of changes within the collection (the addition of items etc).
If your collection property is read-only, you don't need to notify anything that the entire collection has changed to a different one - instead, the event handlers on the collection will be notified of changes within the collection (the addition of items etc). If you need to be able to change which collection the property refers to within the view model, you could always make the setter private and keep the existing notification mechanism.
My collection property is not readonly, but I don't want to write setter for it, user could add or remove anything directly from it, I just want that it'll notify me, whenever it happens and please don't expect it to be Observable collection always, it could be anything List, IEnumerable, dictionary etc. Thanks – MSingh Oct 24 at 6:10 @MSingh: Well that makes a huge difference - if it's a List then there is no notification mechanism. That's the whole point of ObservableCollection.It sounds like you're not clear in your mind on the difference between a read-only property (one without a setter) and an immutable collection (one whose contents can't be changed). It sounds like you only need a read-only property, but returning a mutable (changable) collection.
If you want that collection to notify listeners, you must use ObservableCollection or something very similar. – Jon Skeet Oct 24 at 6:13 Yes, I was little confused about these scenarios, but thanks for your help. Thanks a Lot – MSingh Oct 24 at 6:16.
The ObservableCollection itself informs about changes happened. So you don't need to raise the PropertyChanged Event. If you think, that it's necessary tho change the collection, then you can delete and add items.
Due to the observable pattern, the changes will be anounced.
The fact that you are using a setter means you're trying to replace the instance of the collection with a new object instance. If you just are worried about changes to items in the collection, that's already built into the observablecollection. FxCop is going to complain about the setter whether you had the notifypropertychanges call or not.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.