New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow overriding Dictionary<TKey, TValue> #31318
Comments
When the generic collections like |
Then please create another dictionary elsewhere for easy overriding, like |
Why do you want to override the mutation methods? What problem are you actually trying to solve? |
I'd be fine with just an |
Implement
... sounds like it's going to have some sort of "different" behavior (how, you haven't explained, so I'm not sure why you think you need something different yet). |
I meant that I need both, although I need the notification more often. |
Based on the comments above, and based on my understanding that this is something of low demand, I'm gonna go ahead and gonna close this issue. |
Hi,
I always bump into this need to subclass a dictionary and be able to override its mutation methods, like
Collection<T>
.There is
KeyedCollection<TKet, TValue>
but that only works if the key is exposed via the value.As I'm sure there are, I tried searching for similar proposals but couldn't find any.
My request is that you add virtual
SetItem
,RemoveItem
andClearItems
methods toDictionary<TKey, TValue>
's, or offer a similar functionality inSystem.Collections.ObjectModel
.Alternatively, at least provide methods that get notified when the dictionary change, such as
OnItemSet
etc.The problem is also with
IDictionary<TKey, TValue>
being a very large and verbose interface requiring to implement too many methods, sometimes to solve a very simple task.Thanks
The text was updated successfully, but these errors were encountered: