IDictionary<TKey, TValue>
inherits from IEnumerable<KeyValuePair<TKey, TValue>>
, but IDictionary
for some reason doesn't inherit from IEnumerable<DictionaryEntry>
. I wonder why? I hate to write this ugly .OfType<DictionaryEntry>()
every time when I need to make a query against an IDictionary
.
Because IDictionary
is an older (pre-generics) interface. Changing it would break existing code. It is a legacy.
So the underlying issue is why are you (still) using IDictionary based classes, and can't you upgrade?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With