Zagnieżdżone interfejsy: Cast IDictionary <TKey, IList <TValue>> do IDictionary <TKey, IEnumerable <TValue>>?
Sądzę, że rzucanie jest dość prosteIDictionary<TKey, IList<TValue>>
sprzeciwić sięIDictionary<TKey, IEnumerable<TValue>>
, ale
<code>var val = (IDictionary<TKey, IEnumerable<TValue>>)Value; </code>
rzuca aSystem.InvalidCastException
, i
<code>var val = Value as IDictionary<TKey, IEnumerable<TValue>>; </code>
sprawiaval
zero. Jaki jest właściwy sposób na rzucenie tego?