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>

?

+3
dictionary c # readonlycollection


source to share


No one has answered this question yet

See similar questions:

18
Why doesn't `IList <T>` inherit from `IReadOnlyList <T>`?

or similar:

358
If my interface needs to return Task, what is the best way to implement it without an operation?
298
Why are additional C # 4 parameters defined on the interface not being executed when the class is implemented?
54
IDictionary <TKey, TValue> in .NET 4 is not a covariant
fourteen
Treat object like a dictionary of properties in C #
4
Ambiguous call when method has overloads for IDictionary and IDictionary <TKey, TValue>
4
Will the dictionary <TKey, TValue> use TKey.Equals and TKey.GetHashCode?
3
Why can't / can't IDictionary <TKey, TValue> implement ILookup <TKey, TValue>?
3
Why does IDictionary <TKey, TValue> extend ICollection <KeyValuePair <TKey, TValue >>?
0
How to properly implement and subclass IDictionary interface
0
Shouldn't IDictionary <TKey, TValue> naturally extend ISet <KeyValuePair <Tkey, TValue>>



All Articles
Loading...
X
Show
Funny
Dev
Pics