Why does ObservableCollection not support bulk changes?

前端 未结 4 1497
挽巷
挽巷 2021-01-11 14:48

What are the potential problems caused by an ObservableCollection supporting operations like AddRange or RemoveRange? There must be a

4条回答
  •  甜味超标
    2021-01-11 15:22

    There must be a reason why Microsoft didn't provide them

    They do not provide every possible piece of functionality, it's (also) a cost vs. demand thing.

    You could implement your own collection that supports bulk operations and implements INotifyCollectionChanged.

    Yes. And when you do, you'll find that the collection will have to make choices about how/when to propagate those changes. I never tried but I imagine there are some trade-offs that the View or ViewModel can make better decisions about than a reusable collection.

提交回复
热议问题