I would like to create my own implementation of INotifyCollectionChanged
but I want the observable collection to be a dictionary. Something like:
MyObservableDictionary<KeyValuePair<TKey, TValue>>
After reading this article on MSDN about generics it seems that you can define that as
public class MyObservableDictionary<T> : INotifyCollectionChanged where T : struct
{
public event NotifyCollectionChangedEventHandler CollectionChanged;
}
but this
- does not enforces that the struct should be of type KeyValuePair and
- I don't know how to reference
TKey
andTValue
in the class.
Is there any solution to this?