0

I'm searching for a thread safe ObservableCollection and i found this example here on stackoverflow: Thread safe ObservableCollection

But my public event NotifyCollectionChangedEventHandler CollectionChanged; object always is null. Is there something missing in the example or do i miss something? Or is there an even better solution for this?

Sorry that im asking a new question for this but i can't answer to that comment.

Thanks

cybertronic
  • 117
  • 1
  • 10
  • It's null because no one is subscribed to it. You can use `public event NotifyCollectionChangedEventHandler CollectionChanged = new delegate { };` trick or just add null checks where CollectionChanged is called. – icebat Jul 31 '18 at 14:54
  • That is what i was thinking too, but where to subscribe to that event, when i'm using the `ObservableConcurrentBag`. If i check for null and skip the call, the call will be skipped every time i modify the collection. – cybertronic Aug 01 '18 at 07:03

0 Answers0