Why doesn't IDictionary <TKey, TValue> implement IReadOnlyDictionary <TKey, TValue>?
I noticed that the Dictionary class implements IDictionary<TKey, TValue>
as well IReadOnlyDictionary<TKey, TValue>
.
However, the IDictionary interface does not implement IReadOnlyDictionary<TKey, TValue>
.
This means that if my class has IDictionary<TKey, TValue>
, and I need to pass IReadOnlyDictionary<TKey, TValue>
, I have to create an adapter for that, or use some other job.
IMHO every class that has functionality has functionality IDictionary<TKey, TValue>
as well IReadOnlyDictionary<TKey, TValue>
.
Did they just forget to implement it, or are there really meaningful classes that implement IDictionary<TKey, TValue>
that can't have meaningful implementations IReadOnlyDictionary<TKey, TValue>
?
source to share
No one has answered this question yet
See similar questions:
or similar: