Why doesn't IDictionary<TKey, TValue> implement IReadOnlyDictionary<TKey, TValue>?

506 Views Asked by At

I noticed that Dictionary Class implements IDictionary<TKey, TValue> as well as IReadOnlyDictionary<TKey, TValue>.

However IDictionary Interface does not implement IReadOnlyDictionary<TKey, TValue>.

This means that if my class has an IDictionary<TKey, TValue>, and I need to pass an IReadOnlyDictionary<TKey, TValue> I ought to create an adapter for this, or use a different work around.

IMHO every class that has the functionality of an IDictionary<TKey, TValue> also has the functionality of an IReadOnlyDictionary<TKey, TValue>.

Did they simply forget to implement it, or are there really meaningful classes that implement IDictionary<TKey, TValue> that can't have a meaningful implementations of IReadOnlyDictionary<TKey, TValue>?

0

There are 0 best solutions below