WPF ObservableCollection – Add millions of data within milliseconds

Adding huge amount of Data to an ObservableCollection can cause GUI freezes. Even if operating on another thread, the process of adding items is pretty slow. But why?

Every time an Item gets added to the ObservableCollection, some OnPropertyChanged methods will be called. Therefore, every listener will receive an update, which results in a huge overhead.

To avoid this problem, we implement your own ObservableCollection which truly just adds all the elements without throwing a single OnPropertyChanged event. Only after the whole insertion is done, we call the PropertyChanged events.


Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.