What is the difference between ObservableCollection and INotifyPropertyChanged?

前端 未结 2 1134
抹茶落季
抹茶落季 2021-01-12 13:50

I am confused about how ObservableCollection and INotifyPropertyChanged works.

I have this code:

Payments = new ObservableC         


        
2条回答
  •  旧巷少年郎
    2021-01-12 14:31

    An ObservableCollection notifies its binder, with for example when something is added/deleted to the collection itself.

    What you're doing in the second example however, is notifying the binder that the collection has been replaced by a new collection (something that the ObservableCollection does not do itself, if you do new ObservableCollection - there you lose the binding).

提交回复
热议问题