using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
public static void Main()
var handler = new NotifyCollectionChangedEventHandler((sender, e) => { return; });
var ints = new ObservableCollection<int>();
ints.CollectionChanged += handler;
var doubles = new ObservableCollection<double>();
doubles.CollectionChanged += handler;
_values = new Dictionary<string, object>
_collectionChangedDelegates = new Dictionary<string, NotifyCollectionChangedEventHandler>
static Dictionary<string, object> _values;
static Dictionary<string, NotifyCollectionChangedEventHandler> _collectionChangedDelegates;
static void ClearDelegates()
foreach (var kvp in _values)
var currentValue = _values[kvp.Key];
if (currentValue == null)
var type = currentValue.GetType();
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(ObservableCollection<>))
dynamic observableCollection = currentValue;
observableCollection.CollectionChanged -= _collectionChangedDelegates[kvp.Key];